$class::bar() yields parse error
| From: | Sebastian Bergmann | Date: | Mon, 29 Oct 2001 09:33:30 +0000 |
| Subject: | $class::bar() yields parse error | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-69270@lists.php.net to get a copy of this message | ||
Calling static methods on 'variable' classes currently yields a parse
error:
<?php
class foo {
function bar() {
echo 'foobar';
}
}
$class = 'foo';
$class::bar();
?>
I think it would be great if the above syntax would be possible. Any
technical obstacles, comments?
Doing
<?php
class foo {
function bar() {
echo 'foobar';
}
}
$class = 'foo';
$object = new $class;
$object->bar();
?>
is against the idea of static classes, IMHO.
--
Sebastian Bergmann
http://sebastian-bergmann.de/ http://phpOpenTracker.de/
Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/