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}(); > //

Re: [PHP] Variable Functions...

2003-07-10 Thread Burhan Khalid
On Friday, July 11, 2003, 3:11:51 AM, Michael wrote: MS> Smarty has a class method where it calls: $this->$some_var("somevalue"); Are you sure about that syntax? I'm not too familiar with Smarty, only used it once, but I think its $this->some_var("value"); MS> and this throws errors on Windows

Re: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Gyozo Papp
> > Kirk > > > -Original Message- > > From: Philip Olson [mailto:[EMAIL PROTECTED]] > > Sent: Monday, May 07, 2001 11:45 AM > > To: [EMAIL PROTECTED] > > Subject: RE: [PHP] variable functions: empty/isset/unset invalid? > > > > > &g

Re: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Christian Reiniger
On Monday 07 May 2001 20:11, Johnson, Kirk wrote: > problem for empty(). Also, a User Contributed Note at > http://www.php.net/manual/en/functions.php#functions.user-defined has > this to say: > > > there are tons of good uses for this sort of functionality. But it > should be noted that this wi

RE: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Altunergil, Oktay
>>oktay -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 2:43 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] variable functions: empty/isset/unset invalid? Solved. empty, isset and unset are not functions, they are language contructs, which resu

RE: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Philip Olson
Solved. empty, isset and unset are not functions, they are language contructs, which results in the error. This makes sense, a workaround is creating functions like isEmpty (or something similar) and using them. I'll be submitting a future request soon ;) Thanks everyone, especially OpenSrc i

RE: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Johnson, Kirk
ent: Monday, May 07, 2001 11:45 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] variable functions: empty/isset/unset invalid? > > > > I wish it were that easy. Also, I'm looking for words on WHY this > behavior exists. > > http://www.php.net/manual/en/function

RE: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Philip Olson
I wish it were that easy. Also, I'm looking for words on WHY this behavior exists. http://www.php.net/manual/en/functions.variable-functions.php '; // works $foo = 'is_string'; $var = 'abcdef'; if ($foo($var)) print '$var is a string'; // works $foo = 'strlen'; $var =

RE: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Johnson, Kirk
Change the parens around $var to curly braces: if ($foo{$var}) print 'worked.'; Kirk > -Original Message- > From: Philip Olson [mailto:[EMAIL PROTECTED]] > Subject: [PHP] variable functions: empty/isset/unset invalid? > > This does not work as expected (as I expect it at least) and giv

RE: [PHP] variable functions: empty/isset/unset invalid?

2001-05-07 Thread Altunergil, Oktay
$foo is a string not a PHP function which makes 'empty' a string and not a function/command. Am I missing something? oktay -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 1:04 PM To: [EMAIL PROTECTED] Subject: [PHP] variable functions: empty/i