@rediska If i understand the question correctly
$function = 'getColor';
$color = is_callable($function)
? $function('#ff0000')
: null;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a question about php)
I have a function. Let's say this:
function getColor ($color) {
if ($color == '#ff0000') {
return 'red';
} else {
return null;
}
}
I get a string that should actually be processed like a function.
$str = "getColor(#ff0000)";
How to indicate that this is not a string, but that you need to run the getGender function and pass the '#ff0000' parameter there
Please or to participate in this conversation.