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
Post a Comment