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

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45728
 Updated by:       [email protected]
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.