php4 objects

From: Date: Wed, 13 Oct 2004 02:47:28 +0000
Subject: php4 objects
Groups: php.general 
Request: Send a blank email to php-general+get-199334@lists.php.net to get a copy of this message
A friend of mine asked me if I knew if this was possible in PHP4. class foo { var $bar = NULL; function foo() { $this->bar = new bar(); } function getBar() { return $this->bar; } } class bar { var $thing = NULL; function bar() { $this->thing = "Hello World!"; } function getThing() { return $this->thing; } } he wants to do something like this: $obj =& new foo; print $foo->getBar()->getThing(); is this possible in PHP4? I know that he can do a: print $obj->bar->getThing(); ..but he wants it to run some stuff in the functions that he is calling and wants to do it in one command if possible. -Robby -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | robby@planetargon.com * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development ****************************************/

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.general (#199334) next »