Re: [PHP] Getting static member for a class which name is stored in a variable

2004-11-27 Thread Jake Press
Simas Toleikis wrote:
Jake Press wrote:
Hi Francisco,
Your not alone, a number of other users have enountered this bug.

string get_class ( object obj )
Its not a bug...
You are getting class name as a string for output purposes etc..
Doing something like "TestClass"::some_static is ofcourse illegal wih 
strings.

Morning,
Umm, it is an unclear syntax limitation, which is a bug.
... either language or manual.
i understand what you are saying, i beleive i disclaimer'd my own 
examples somewhere down the line in those threads ;)

i beleive there should be a better way to do this without:
- using reflection
- instantiating the class and using a method to retrieve the variable
- eval
Also please notice the existance of the "call_user_func" and what this 
gives us ;)
= this gives us a solution (workaround??) to access static functions 
within a class

Perhaps we need a similar function to provide access to our static 
variables! :)

Best Regards
Jake Press
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Getting static member for a class which name is stored in a variable

2004-11-26 Thread Simas Toleikis
Jake Press wrote:
Hi Francisco,
Your not alone, a number of other users have enountered this bug.
string get_class ( object obj )
Its not a bug...
You are getting class name as a string for output purposes etc..
Doing something like "TestClass"::some_static is ofcourse illegal wih 
strings.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Getting static member for a class which name is stored in a variable

2004-11-25 Thread Jake Press
Hi Francisco,
Your not alone, a number of other users have enountered this bug.
:(
I have submitted a bug report, here: http://bugs.php.net/bug.php?id=30716
It would be appreciated if you show your support for this bug by 
commenting/voting etc :)

I also have a `thread` on the php.generals mailing list you may want to 
read, here: http://news.php.net/php.general/201458

Just quickly here is a dodgy workaround to get you moving
   echo eval('return '. $ClassName .'::$Data;');
:)
Best Regards
Jake Press
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Getting static member for a class which name is stored in a variable

2004-11-25 Thread Francisco M. Marzoa Alonso
I've code like follows:

class TestClass {
   public static $Data = 'This is the data';
}
$Obj = new TestClass ();
$ClassName = get_class ($Obj);
echo $ClassName::$Data;
?>
It gives me an error like:
Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM ...
I've found googling that it means that those '::' are unexpected. So, 
How can I get an static member for a class which name is stored in a 
variable?

Thx.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php