Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2005051

[PHP] Array of objects From: Thomas Hochstetter (thomas.hochstetter <email protected>)
Date: 05/05/05

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 <email protected> <mailto:info <email protected>>
Web: www.spiraleye.co.za