Getting static property from a class with dynamic class name in PHP

If you are using PHP 5.3.0 or greater, you can use the following: $classname::$$propertyname; Unfortunately, if you are using a version lower than 5.3.0, you are stuck using eval() (get_class_vars() will not work if the value is dynamic). $value = eval($classname.’::$’.$propertyname.’;’); EDIT: I’ve just said get_class_vars() wouldn’t work if the value is dynamic, but apparently, … Read more