Re: [PHP] Variable functions within an object

2004-07-30 Thread Julio Sergio Santana
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: function foo() { echo "In foo()\n"; } class a { var $fname;

Re: [PHP] Variable functions within an object

2004-07-30 Thread Curt Zirzow
* Thus wrote Julio Sergio Santana: > > Curt Zirzow wrote: > > > $this->{$this->fname}(); > > > > or (what it actually is doing.. ) > > > > $func = $this->fname; > > $this->$func(); > > > >Curt > > The point here is that the named function is outside the object. That > is, $this->foo() doesn

Re: [PHP] Variable functions within an object

2004-07-30 Thread Julio Sergio Santana
Curt Zirzow wrote: $this->{$this->fname}(); or (what it actually is doing.. ) $func = $this->fname; $this->$func(); Curt The point here is that the named function is outside the object. That is, $this->foo() doesn't exist, so $this->{$this->fname}(), does not work either. But if you look

Re: [PHP] Variable functions within an object

2004-07-29 Thread Jason Davidson
http://ca3.php.net/manual/en/function.call-user-func.php ? Jason On Thu, 29 Jul 2004 17:11:50 -0500, Julio Sergio Santana <[EMAIL PROTECTED]> wrote: > I need to record the names of functions, and then use them later. > Recently I found the following example within the on-line documentation: >

Re: [PHP] Variable functions within an object

2004-07-29 Thread Curt Zirzow
* 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}(); > //

[PHP] Variable functions within an object

2004-07-29 Thread Julio Sergio Santana
I need to record the names of functions, and then use them later. Recently I found the following example within the on-line documentation: \n"; } $func = 'foo'; $func();// This calls foo() ?> then I supposed that it was easy to extend this concept to objects and wrote the following case: