|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-06-24 12:44 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 12:00:01 2025 UTC |
Description: ------------ Basically, a call to a static class method produces a parse error. Unexpected Paamayim Nekudotayim (::). This sort of coding works on normal method calls, and object instantiation. For example, the following works fine: $name = "ClassName"; $instance = new $name(); ^^ will create a new instance of ClassName; or public function method() { //some code } $methodName = "method"; $methodName(); ^^ will run method(). Reproduce code: --------------- class ClassName { public static function staticClassMethod() { //some code } } $name = "ClassName"; $name::staticClassMethod(); Expected result: ---------------- I expected php to call the method "staticClassMethod". Actual result: -------------- Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM ...