Curt Zirzow wrote:
or for the oneline purists :)
${ ${$this->fname} = $this->fname }();
wow.. ${} is more powerful than i had originally though.
Thank you Curt,
With your suggestion, I finally re-wrote the example, and here it is:
<?php
function foo() { echo "In foo()<br />\n"; }
class a { var $fname; function a() { $this->fname = 'foo'; // the name of the function }
function execute() { // method to execute the named function ${${$this->fname}=$this->fname}(); } }
$w = new a; $w->execute();
?>
And this outputs:
X-Powered-By: PHP/4.1.2 Content-type: text/html
In foo()<br />
Thank you again,
Sergio.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php