Re: [PHP4BETA] Problem with variable functions
| From: | Andi Gutmans | Date: | Sun, 12 Mar 2000 21:21:13 +0000 |
| Subject: | Re: [PHP4BETA] Problem with variable functions | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11988@lists.php.net to get a copy of this message | ||
At 03:29 PM 3/12/00 -0500, chagenbu@wso.williams.edu wrote:
Here's a small snippet that demonstrates an inconsistency with the user-callable
function code:
<?php
class Foo {
function bar () {
echo 'Foo::bar() called';
}
}
// this works
Foo::bar();
// this doesn't
$func = 'Foo::bar';
$func();
?>
Am I right in guessing that this is the same issue that prevents "Foo::bar"
being passed to usort()?
If so, can this be fixed before RC1?
This won't be fixed as it isn't a bug. It is just the way it works.
What we could support at some point is $foo::$bar() but it won't happen before PHP 4.
For now you could theoretically do eval("$func();") but it isn't the nicest thing. Are you sure there isn't a different way to write your code?
Andi
---
Andi Gutmans <andi@zend.com>
http://www.zend.com/