A typical use for this exception, is in conjunction with the is_callable() function.
PHP - Manual: BadFunctionCallException
2024-11-13
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Exception thrown if a callback refers to an undefined function or if some arguments are missing.
A typical use for this exception, is in conjunction with the is_callable() function.
For example:
function foo($arg) {
$func = 'do' . $arg;
if (!is_callable($func)) {
throw new BadFunctionCallException('Function ' . $func . ' is not callable');
}
}
官方地址:https://www.php.net/manual/en/class.badfunctioncallexception.php