Static method call syntax on objects
| From: | Sebastian Bergmann | Date: | Wed, 10 Aug 2011 20:12:41 +0000 |
| Subject: | Static method call syntax on objects | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-54497@lists.php.net to get a copy of this message | ||
Is this exepcted behaviour?
➜ ~ cat test.php
<?php
class Foo {
public static function bar() {
print __METHOD__ . "\n";
}
}
$foo = new Foo;
$foo::bar();
➜ ~ php test.php
Foo::bar
I, for one, was surprised that this does what it does with PHP 5.3 and
PHP 5.4 (do not have older version of PHP hand).
--
Sebastian Bergmann Co-Founder and Principal Consultant
http://sebastian-bergmann.de/
http://thePHP.cc/