There's some PHP code assigned to one variable ($phpCode) that may contain a function called runjustthis() or/and any other php code.
I'm looking for a possibility to run just that function runjustthis() with eval().
In other words, how do I extract (with a regex?) the function runjustthis() from the string $phpCode and then call eval() on the extracted string?
Pseudo code:
$phpCode = "
function runjustthis() {
// some code here...
}
// maybe some more code here...
// Don't execute that:
$something = '123';
somethingElse();
";
$runjustthis = extractFunction("runjustthis", $phpCode);
eval($runjustthis);