Is there a way in PHP for me to specify that an array will consist only of certain types of objects? -


for example suppose have car object , want array consist of cars. there syntax allows me this?

no. php not have strong typing.

the way can think of enforcing have cararray class has getters,setters,etc.. functions enforce parameters of class car.


Comments

Popular posts from this blog

mod rewrite - Doing external redirect. .htaccess NS flag not working. How to achieve similar results? -

mysql - How to insert just year and month into date field? -