#30716 [Com]: Dynamic Static Member Access
| From: | k at ailis dot de | Date: | Tue, 09 Nov 2004 08:27:21 +0000 |
| Subject: | #30716 [Com]: Dynamic Static Member Access | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-68832@lists.php.net to get a copy of this message | ||
ID: 30716
Comment by: k at ailis dot de
Reported By: jake at development dot mindvision dot com dot au
Status: Open
Bug Type: Scripting Engine problem
Operating System: Gentoo Linux (2.4.x)
PHP Version: 5.0.1
New Comment:
Just for info: The problem is also present in latest CVS. And even if
it is not a bug it's still a useful feature request.
Previous Comments:
------------------------------------------------------------------------
[2004-11-08 05:59:14] jake at development dot mindvision dot com dot au
Description:
------------
Hello,
I feel i have a syntax bug or unclear syntax limitation.
I am trying to access static members of classes, dynamically
ie $foo = 'className'; echo $foo::$staticVariable;
For more information please see my posts on the php-generals list
- http://news.php.net/php.general/201458
Thanks in advance
Yours Sincerely
Jake Press
Reproduce code:
---------------
<?php
// Define a class with a nice juicy static variable
class bob {
public static $type = 'safd';
}
// Lets chuck the name of the class into a variable...
$foo = 'bob';
// Just to show it all works lets do it manualllllly
echo bob::$type;
// This is the line with the well-wicked parse error on the
double colon
echo $foo::$type;
?>
Expected result:
----------------
safdsafd
Actual result:
--------------
Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting
',' or ';' in /mnt/data0/www/twd/test.php on line 15
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30716&edit=1