|
Posted by L Robbins on 06/05/05 14:06
I am a newcomer to PHP and am writing a script which dynamically creates
instances of a class with names like $object1, $object2, etc.. I now
want my script to be able to list all of the objects which are instances
of a specific class -- but I haven't been able to find any code which
does this in the online PHP references I've consulted. Given that the
names of the objects are predictable, it would be possible for me to
write some code which looped sequentially through the object names
$object1, $object2, etc., until it reached an object name which didn't
exist. However, I was expecting there to be a tidier, easier way of
doing the same thing with a command that says simply "List all instances
of class X."
Could you please tell me how to do this, or why it is not possible?
[Back to original message]
|