|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-12-06 08:19 UTC] mike@php.net
-Type: Bug
+Type: Documentation Problem
[2013-12-22 11:56 UTC] salathe@php.net
-Status: Open
+Status: Wont fix
[2013-12-22 11:56 UTC] salathe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 03:00:01 2025 UTC |
Description: ------------ Documentation says: "As of PHP 5.3.0, it's possible to reference the class using a variable. The variable's value can not be a keyword (e.g. self, parent and static)." It does not say that class variables cannot be used, but trying to do so will result in the completely nonsensical error for non-hebrew speakers. referencing the variable that references the class name does work, but it is a useless line in my code, i don't like it. public function foo() { $tmp =& $this->bar; echo $tmp::$my_static; } Test script: --------------- <?php class Foo { public static $my_static = 'foo'; } class Bar { protected $bar; public function __construct() { $this->bar = 'Foo'; } public function foo() { echo $this->bar::$my_static; } } $bar = new Bar(); $bar->foo(); Expected result: ---------------- foo Actual result: -------------- Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in C:\ ... \test.php on line 12