|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patches55247.diff (last revision 2011-07-27 04:46 UTC by pierrick@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-22 18:53 UTC] felipe@php.net
-Type: Bug
+Type: Feature/Change Request
[2011-07-22 18:53 UTC] felipe@php.net
[2011-07-27 04:46 UTC] pierrick@php.net
[2011-08-01 11:46 UTC] dmitry@php.net
-Assigned To:
+Assigned To: dmitry
[2011-08-01 12:10 UTC] dmitry@php.net
-Status: Assigned
+Status: Closed
[2011-08-01 12:10 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 23:00:01 2025 UTC |
Description: ------------ PHP allows to call instance methods using the {} syntax together with a string - such as $obj->{'my-method'} for example. This allows developers to call methods whose names are not valid PHP method names. The same does not work with static method calls. Test script: --------------- <?php class Test{ public static function __callStatic($method, $arguments) { echo $method . PHP_EOL; } public function __call($method, $arguments) { echo $method . PHP_EOL; } } $method = 'method'; $test = new Test(); $test->method(); $test->$method(); $test->{'method'}(); Test::method(); Test::$method(); Test::{'method'}(); Expected result: ---------------- method method method method method method Actual result: -------------- PHP Parse error: syntax error, unexpected '{', expecting T_STRING or T_VARIABLE or '$' in Untitled.php on line 21