I'm receiving prepared function as strings like these:
"\app\models\AddrModel::getText('A_00001724');"
Now I need to convert and run this string as static function call, to retrieve the value if the A_00001724 id.
How do I do that?
PS: When I call it as $value = new $function; I get
Class '\app\models\AddrModel::getText('A_00001724')' not found
since it's not just class. It`s static function with class :/
evaldoesn't return any value, so this wont work for me.$func = "sprintf('%s %s', 'hello', 'world');"; $value = eval('return '.$func); print_r($value); // echo "hello world"$value = eval('return '.$function.';');. You should put it as answer, so I can accept it.evalis a bit risky in some cases so make sure the$functionvalue is being checked and validated prior to usage.