Re: Variable functions within an object

From: Date: Thu, 29 Jul 2004 23:35:33 +0000
Subject: Re: Variable functions within an object
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192256@lists.php.net to get a copy of this message
* Thus wrote Julio Sergio Santana: > > class a { > var $fname; > function a() { > $this->fname = 'foo'; // the name of the function > } > > function execute() { // method to execute the named function > $this->fname(); > // I also tried here > // {$this->fname}(); > // ${this->fname}(); > // "$this->fname"(); $this->{$this->fname}(); or (what it actually is doing.. ) $func = $this->fname; $this->$func(); Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#192256) next »