can you initialize a static array of objects in a class in PHP? Like you can do
class myclass {
public static $blah = array("test1", "test2", "test3");
}
but when I do
class myclass {
public static $blah2 = array(
&new myotherclass(),
&new myotherclass(),
&new myotherclass()
);
}
where myotherclass is defined right above myclass. That throws an error however; is there a way to achieve it?
$blah2
within the constructor. You can't set runtime-calculated values in a property definition. – Wiseguy May 27 '12 at 3:56new
by reference there has been depreciated for several years now. Maybe it's slipped under PHP's radar and that's why it still remains to this day without causing a fatal error. But, just so you know. – bob-the-destroyer May 27 '12 at 4:16