How to access properties of objects within objects

From: Date: Fri, 29 Nov 2002 18:01:40 +0000
Subject: How to access properties of objects within objects
Groups: php.general 
Request: Send a blank email to php-general+get-126492@lists.php.net to get a copy of this message
Can't figure out how to get at the properties of an object which itself is a property of another object. In sample code below neither the assignment of $mystring produces an error. <?php class Obj1 { function Obj1 ($string) { $this->string = $string; } } class Obj2 { function Obj1 ($obj) { $this->obj = $obj; } var $mystring = $this->obj->string; } $o1 = New Obj1("hello"); $o2 = New Obj2($o1); print "\$o2->mystring = $o2->mystring<br>" ?> -- Randall Perry sysTame Xserve Web Hosting/Co-location Website Development/Promotion Mac Consulting/Sales http://www.systame.com/

« previous php.general (#126492) next »