Array of objects
| From: | Thomas Hochstetter | Date: | Thu, 05 May 2005 12:52:07 +0000 |
| Subject: | Array of objects | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-214604@lists.php.net to get a copy of this message | ||
Spiraleye.Studios
Hi there,
I need help with arrays. What I want to do is to have an array of the
following structure:
$mod=array( 'name'=>new NameObject());
Then later in the page I want to go $Site = $mod[$_GET['module']] (or
something like that) to instantiate a new object.
The problem is, if done the way above it will try to instantiate the object
right there and then in the array (defeating the purpose), if I put it in
quotes and try to use something like:
(object)eval($mod[$_GET['module']]) it does not instantiate the object. Is
there a way to do this?
Thanks
Thomas
SPIRAL EYE STUDIOS
P.O. Box 37907, Faerie Glen, 0043
Tel: +27 12 362 3486
Fax: +27 12 362 3493
Mobile: +27 83 258 2669
Email: info@spiraleye.co.za <mailto:info@spiraleye.co.za>
Web: www.spiraleye.co.za