I'm pretty new to OOP, but I have a class, and with each object created, I'm pushing them into an array (I don't think there's a way to iterate over every object in a class). My client is still on PHP4, so I was having some trouble.
Since version 4 doesn't come with the __construct method, I made my own:
function construct() {
global $LIST;
array_push($LIST, &$this);
}
Without the &
before $this
, it's just adding an empty object into the array because after it's instantiated, I change some properties for each object. Now it's throwing me a warning, though:
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of array_push(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file.
I tried to just suppress the warning, but a @ in front of the array_push()
doesn't work. And apparently the error_reporting(0)
won't work unless it's in my root file (all of this stuff is inside of an include on many, many pages). I don't have access to the php.ini file either.