Given the class string name in PHP, how can I access one of my static variables?
What I would like to do is:
$className = 'SomeClass'; // assume string was actually handed in as a parameter $foo = $className::$someStaticVar;
... but PHP gives me the excellent "Syntax error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM", which is apparently the Hebrew name for the double colon (: :).
Update: Unfortunately, I have to use PHP 5.2.X for this.
Update 2: As suggested by MrXexxed, a static variable is inherited from the parent class.
php static
Nathan Long Jul 28 '10 at 15:41 2010-07-28 15:41
source share