The BadFunctionCallException class

(PHP 5 >= 5.1.0)

Introduction

Exception thrown if a callback refers to an undefined function or if some arguments are missing.

Class synopsis

BadFunctionCallException extends LogicException {
/* Inherited properties */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
/* Inherited methods */
final public string Exception::getMessage ( void )
final public Exception Exception::getPrevious ( void )
final public mixed Exception::getCode ( void )
final public string Exception::getFile ( void )
final public int Exception::getLine ( void )
final public array Exception::getTrace ( void )
final public string Exception::getTraceAsString ( void )
public string Exception::__toString ( void )
final private void Exception::__clone ( void )
}
add a note add a note

User Contributed Notes 3 notes

up
3
Gilles A
4 months ago
For example :
<?php
class Image
   
{
    public function
__construct()
        {
        if (!
extension_loaded('gd'))
            {
            throw new
BadFunctionCallException('GD extension is not loaded.');
            }
        }
    }
?>
up
2
tom at tomwardrop dot com
4 years ago
A typical use for this exception, is in conjunction with the is_callable() function.
up
-2
Dawid Krysiak
3 years ago
Direct known subclasses:
BadMethodCallException

So BadMethodCallException can be used in case the subject function is or should be a part of class / object - it's use defines the case more precisely.
To Top