In this case, is it necessary to use eval?

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

< hr >

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!

Php
Aug.12,2021

<?php

class C
{
public static $s = 123;
}
$x = "s";
$c = new C();
echo $c::$$x;
//123

echo C::$$x;
//123

got it.
you use this

echo get_class_vars("C")["s"];
Menu