I've just stumbled upon something today that seemed "unethical" in PHP. What I originally thought as malpractice, turned out to work just fine. Basically what I was wondering is if pushing an instantiated class in an array was considered proper?
Example:
$array = array();
array_push($array, new myClass());
foreach($array as $i => $class)
{
$class->doSomething();
}
Although this example is quite vague, the idea is there. Any input or alternatives on this matter would be great.