| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2010-11-24 15:34 UTC] jani@php.net
 
-Summary: Allow use funtion or class for rvalue of static
          variable
+Summary: Allow use function or class for rvalue of static
          variable
  [2021-07-23 07:36 UTC] nikic@php.net
 
-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: nikic
  [2021-07-23 07:36 UTC] nikic@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 15:00:01 2025 UTC | 
Description: ------------ Now language allow only constant for static variable in function (static $a = 0). Please allow functionality such as in C++ Test script: --------------- class testA { private function __constructor(){} public static function getInstance() { static $a = new testA(); return $a; } public function a() { return 5; } } $a = testA::getInstance(); echo $a->a(); exit; Expected result: ---------------- 5 Actual result: -------------- fatal error PHP Parse error: syntax error, unexpected T_NEW