View Full Version : how to perform dynamic cascading references ??

02-25-2008, 09:33 AM
Hello forums!!
I would like to how to access nested objects
supppose i had an array

$array = array("parent_obj", "child_obj1", "child_obj2");
I would like to perform referencing as per array ie


I dont know how to perform dynamic cascading references.
Can anybody make a help on this.
Any help / comment/ suggestions are warmly welcome.

02-25-2008, 12:31 PM
Thanks i got it working by performing as:

$element = '';
foreach ($array as $obj){
$element .= '->'.$obj;
$element = trim($element, "->");
eval('$return = $this->'.$element.';');
return $return;