Asking for the impossible?

From: Date: Fri, 24 Mar 2000 03:44:48 +0000
Subject: Asking for the impossible?
Groups: php.version4 
Request: Send a blank email to php-version4+get-12551@lists.php.net to get a copy of this message
Hello list, I'm looking for a way to call a class method within a string. Example, class Cart { var $count; function show(){ $str = "I'm an empty cart<p>"; $this->count++; return $str; } } $cart = new Cart; // A here doc print <<< END <HTML> Status: $cart->show() Count: $cart->count </HTML> END; I' like the output to be: Status: I'm an empty cart Count: 1 However, the $cart->show() is embedded in a string, or in this case a here doc, and so I get the output: Status: Count: 1 Any ideas? --pk

« previous php.version4 (#12551) next »