PHP allocates memory dynamically and, whatโs more, it doesnโt matter which object you store in your array.
If you want to declare an array before using it, follow these steps:
var $myArray = array();
Then you can save any object you like in the $ myArray variable. Many people find this strange concept understandable after working in a strict language such as java.
source share