I’m just starting to learn about OOP in PHP. I am wondering about the use of arrays as properties in a class. I have Googled and there is a lot about the difference between objects and arrays and converting arrays to objects, but not much about using an array as a property. I have been able to find out how to do it (I believe you simply write
when creating the class.)
I am wondering if there are reasons why this is a bad thing to do or whether there are better ways of doing things or if the reason for the lack of information is simply that it is no big deal and there is not much to say about it?
The reason why I am asking is that I am thinking about recoding a little routine I wrote that deals with a number of prices. The user enters the prices, the number of which could be different on different occasions. It seems that an array would be the best way to deal with that. Any comments/pointers welcome, to aid my learning process.