function_exists

Return TRUE if the given function has been defined

Syntax

function_exists ( string $function_name ) : bool

Parameters

function_name

The function name, as a string.

Return

Returns TRUE if function_name exists and is a function, FALSE otherwise.

Note: This function will return FALSE for constructs, such as include_once and echo.

Examples

<?

function myfunction() {
    echo "Hello";
}

$function_name = "myfunction";

$return = function_exists($function_name);

echo $return;

?>
1

PHP

Home Menu