Im trying to call a function dynamically, using call_user_func_array, but the issue I’m facing is that if the function returns boolean,Parameter variables are stored in an array, but if the function returns a string it will work fine
call_user_func_array() expects parameter 1 to be a
valid callback, function ‘equal’ not found or invalid function
name not included in …
$param = array (
0 => Jill
1 => Jack
);
echo call_user_func_array("equal", $param);
function equal($str, $str_2) {
if ($str==$str_2) {
return true;
} else {
return false;
}
}
I tried your script. it is working and returning “false”.
Just use var_dump() instead of echo to test it.
And if equal() is returning array then array is also returned. no errors for me.