How can I do this -- method chaining

From: Date: Tue, 29 Jan 2008 18:53:04 +0000
Subject: How can I do this -- method chaining
Groups: php.general 
Request: Send a blank email to php-general+get-268266@lists.php.net to get a copy of this message
Constructors return the object, correct? If so, how can I do this: class Bob { private $blah; _construct( $blah ) { $this->blah = $blah; } public getBlah() { return $this->blah; } } echo Bob( 'Hello!' )->getBlah(); When I try that, I get the message "Undefined function Bob". I've also tried echo new Bob( 'Hello!' )->getBlah(); echo (new Bob( 'Hello!' ))->getBlah(); but PHP didn't like either of those at all. Is it just not possible what I'm trying to do? I'm using PHP5.2.1 thnx, Chris

« previous php.general (#268266) next »