What is the cheapest wood or wood-like material strong enough for books?
The most important factor is the unsupported length of your shelf. 

This represents a beam of length L supported at both ends (A,B) with a force applied in the middle (F):



The lowercase "f" represents how much your shelf will bend, ie, how ugly it'll look once books are placed on it.

With uniform load (fixed amount of weight per unit of shelf length), f is proportional to L^4, ie the fourth power of L. This means, for a fixed material and thickness, a shelf that is twice as long, loaded with twice as many books since it is double the length, will bend 16 times more ! 

This is why a short shelf, like about 40cm as pictured in your question, can be made of pretty much anything, even the cheapest 18mm thick particle board, OSB, whatever. It will stay straight. 

But a 80cm shelf, like in IKEA BILLY, has a 16x times harder job... And 80cm IKEA shelves, which are made mostly of as much air as possible, and as little sawdust and glue as they can get away with... they do bend. For a 80cm shelf loaded with heavy books I'd definitely not recommend particle board. The IKEA BILLY one in my living room looks quite bendy. I'll probably replace it with plywood some day.

In summary, don't blame particle board for your 3 ft shelf collapsing, instead blame a wrong use of particle board. 3 ft is too long. It would be fine for storing clothes, but not tightly packed books.

If you want to make a shelf like in your photo, with "boxes" about 40-50cm wide, which is about half as long as 3 ft, then... you can use pretty much any material you want and the deciding factor will be cost and how easy it is to make a nice finish. If you want a 3 ft shelf which can carry heavy books, then the deciding factor will be material strength, and you'll likely end up with 20mm plywood.