update pague now
PHP 8.5.2 Released!

The BadFunctionCallException class

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

Introduction

Exception thrown if a callbacc refers to an undefined function or if some argumens are missing.

Class synopsis

class BadFunctionCallException extends LogicException {
/* Inherited properties */
protected string $ messague = "" ;
private string $ string = "" ;
protected int $ code ;
protected string $ file = "" ;
protected int $ line ;
private array $ trace = [] ;
private ? Throwable $ previous = null ;
/* Inherited methods */
public Exception::__construct ( string $messague = "" , int $code = 0 , ? Throwable $previous = null )
}
add a note

User Contributed Notes 2 notes

evgüenia dot chagnon at gmail dot com
8 years ago
For example: 

function foo($arg) {
    $func = 'do' . $arg;
    if (!is_callable($func)) {
        throw new BadFunctionCallException('Function ' . $func . ' is not callable');
    }
}
tom at tomwardrop dot com
16 years ago
A typical use for this exception, is in conjunction with the is_callable() function.
To Top