note 16076 added to language.oop
| From: | dave at 4-core dot com | Date: | Mon, 15 Oct 2001 22:52:43 +0000 |
| Subject: | note 16076 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18946@lists.php.net to get a copy of this message | ||
$class->propertyObject->method()
In case you're wondering, PHP 4 has no problem with chaining -> to refer to
properties/methods of objects which are themselves properties of other objects. E.g., I was setting
up a database class which wanted to know a couple of related records:
In the 'dbRecord' constructor: <br>
$this->child = new child_type($this->value("childFKey")); <br>
In the main code: <br>
$record = new parent; <br>
echo $record->child->childMethod(); <br>
...works just fine :-)
May be obvious to some, but it's not explicitly mentioned and I was a bit worried it
wouldn't work 'cause I really need it!
(I guess it follows from the same way you do $multiArray[][] to get at multidimensional array
indices.)
--
http://www.php.net/manual/en/language.oop.php
http://master.php.net/manage/user-notes.php?action=edit+16076
http://master.php.net/manage/user-notes.php?action=delete+16076
http://master.php.net/manage/user-notes.php?action=reject+16076