php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72802 static $$var; // not work
Submitted: 2016-08-10 11:31 UTC Modified: 2016-08-10 14:01 UTC
Votes:3
Avg. Score:3.7 ± 1.9
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: bear8811 at mail dot com Assigned:
Status: Wont fix Package: Unknown/Other Function
PHP Version: 7.0.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bear8811 at mail dot com
New email:
PHP Version: OS:

 

 [2016-08-10 11:31 UTC] bear8811 at mail dot com
Description:
------------
function fnc($var) {
  static $$var;
}

// Parse error: syntax error, unexpected '$', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /var/www/ex/data/www/ex.com/system/core.php on line 2

Actual result:
--------------
// Parse error: syntax error, unexpected '$', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /var/www/ex/data/www/ex.com/system/core.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-10 11:44 UTC] deon at keemail dot me
-PHP Version: 7.0.9 +PHP Version: 7.0.2
 [2016-08-10 11:44 UTC] deon at keemail dot me
php 7.0.2
 [2016-08-10 12:06 UTC] nikic@php.net
-Type: Bug +Type: Feature/Change Request
 [2016-08-10 12:06 UTC] nikic@php.net
To clarify, this has never worked, so marking it as a feature request.

I don't think this will be implemented, as it does not seem like a particularly useful feature and it will only complicate implementation.
 [2016-08-10 13:02 UTC] bear8811 at mail dot com
OMG, it is BUG!
 [2016-08-10 13:18 UTC] bear8811 at mail dot com
-: deon at keemail dot me +: bear8811 at mail dot com -Operating System: +Operating System: Linux
 [2016-08-10 13:18 UTC] bear8811 at mail dot com
This functionality is necessary for me.
 [2016-08-10 13:21 UTC] nikic@php.net
What do you need this for? Why cannot your use-case be expressed (more clearly) in terms of a static array?

function fnc($var) {
    static $vars = [];
    // use $vars[$var]
}
 [2016-08-10 13:31 UTC] bear8811 at mail dot com
No. Then I'll have to edit the code every day)
 [2016-08-10 14:01 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2016-08-10 14:01 UTC] nikic@php.net
Sorry, this conversation is not proving fruitful. Won't Fix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 01:01:30 2024 UTC