class C
{
public static $s = 123;
}
/ / assuming that you now have to access the CRV _ Ranger _ codes through a string of class names, is there any other way to do this than to write this?
$c = "return";
echo eval ("return". $c. ":: $s"); / / 123
I would like to add that the real situation is that there is a function
function f ($c) {
/ / it is known that $c is a fully qualified class name, for example, for a class represented by "abcdefC"
/ / and $c, there must be a static variable $s (which may come from an inherited parent class, it doesn"t matter)
/ / the question is, how do I get the value of $s?
/ / it is feasible to use eval. I wonder if there is a better way?
}
Thank you!