#45728 [Opn->Fbk]: Static references via Variable Variables

From: Date: Thu, 07 Aug 2008 09:53:10 +0000
Subject: #45728 [Opn->Fbk]: Static references via Variable Variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127715@lists.php.net to get a copy of this message
ID: 45728 Updated by: jani@php.net Reported By: thinice at gmail dot com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: FreeBSD PHP Version: 5.2.6 New Comment: Where exactly it says this should work..? Previous Comments: ------------------------------------------------------------------------ [2008-08-06 02:00:46] thinice at gmail dot com Description: ------------ When you try to access a static variable within a class using a variable variable to determine which class and static to use. Reproduce code: --------------- <? class MyTest { static $myVar = 'testval'; } $sClass = 'MyTest'; echo "Expected output: ".MyTest::$myVar; echo "<br/>"; $s = $sClass.'::$myVar'; echo "Using this as the string: ".$s."<br/>"; echo "Using Variable-named reference: ".${$s}; ?> Expected result: ---------------- Expected output: testval Using this as the string: MyTest::$myVar Using Variable-named reference: testval Actual result: -------------- Expected output: testval Using this as the string: MyTest::$myVar Using Variable-named reference: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45728&edit=1

« previous php.bugs (#127715) next »