RE: [PHP] OO Question for PHP4

From: Date: Wed, 11 Aug 2004 15:21:50 +0000
Subject: RE: [PHP] OO Question for PHP4
Groups: php.general 
Request: Send a blank email to php-general+get-193455@lists.php.net to get a copy of this message
[snip] Hi all. As the subject suggests, I am using PHP4 and am having something going on that I don't think should be. Presume the following code class Foo { function Foo () { return "Bar"; } } $foo = new Foo; echo $foo; $foo comes out as an object. Does this have to be done in two line like this?: class Foo { function bar () { return "Bar"; } } $foo = new Foo; $bar = $foo->bar; [/snip] This is correct. $foo = new Foo; // calls $foo as the object echo $foo; // echo's an object "Bar" would then be a public member of $foo, hence $foo->bar.

« previous php.general (#193455) next »