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 at

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't exist, so

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: ?php function foo() { echo In foo()br /\n; } class a { var

[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: ?php function foo() { echo In foo()br /\n; } $func = 'foo'; $func();// This calls foo() ? then I supposed that it was easy to extend this concept to

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 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: ?php

Re: [PHP] Variable Functions...

2003-07-11 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

[PHP] Variable Functions...

2003-07-10 Thread Michael Smith
Smarty has a class method where it calls: $this-$some_var(somevalue); and this throws errors on Windows versions of php that i've tried. why is that? -Michael -- Pratt Museum IT Intern All programmers are playwrights and all computers are lousy actors. -- PHP General Mailing List

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

2001-05-07 Thread Philip Olson
This does not work as expected (as I expect it at least) and gives the following error. This seems to result with use of empty(), isset(), and unset(), perhaps others : Call to undefined function: empty() When using : $foo = 'empty'; if ($foo($var)) print 'worked.'; Of course the

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

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 gives

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

2001-05-07 Thread Philip Olson
- 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 gives the following error. This seems to result with use of empty(), isset(), and unset(), perhaps others

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

2001-05-07 Thread Johnson, Kirk
, 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/functions.variable-functions.php ?php // works

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

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

2001-05-07 Thread Altunergil, Oktay
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 results in the error. This makes sense, a workaround is creating functions

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

2001-05-07 Thread Gyozo Papp
:[EMAIL PROTECTED]] Sent: 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/functions.variable