PHP | function_exists() Function Last Updated : 14 Mar, 2018 Comments Improve Suggest changes Like Article Like Report The function_exists() is an inbuilt function in PHP. The function_exists() function is useful in case if we want to check whether a function() exists or not in the PHP script. It is used to check for both built-in functions as well as user-defined functions. Syntax: boolean function_exists($function_name) Parameter: This function accepts a single parameter $function_name. This is the name of function that we want to search in the list of defined function. This is a string type parameter. Return Values: This function returns a Boolean value. In case a function with the name $function_name exists it returns TRUE, otherwise it returns FALSE. This function will also return FALSE for constructs like "include_once", "echo" etc. Below programs illustrate the function_exists() function in PHP: Program 1: PHP <?php // PHP program to illustrate function_exists() // checking if the in_array() built-in function // exists or not if (function_exists('in_array')) { echo "in_array() function is available.\n"; } else { echo "in_array() function is not available.\n"; } ?> Output: in_array() function is available. Program 2: PHP <?php // PHP program to illustrate function_exists() // declaring a function named WelcomeMsg function WelcomeMsg() { echo "Welcome to GeeksforGeeks"; } // checking if the function named WelcomeMsg // exists or not if (function_exists('WelcomeMsg')) { echo "WelcomeMsg() function is available.\n"; } else { echo "WelcomeMsg() function is not available.\n"; } ?> Output: WelcomeMsg() function is available. Reference: http://php.net/manual/en/function.function-exists.php Comment More infoAdvertise with us Next Article PHP | function_exists() Function S sid4321 Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP create_function() Function The create_function() is an inbuilt function in PHP which is used to create an anonymous (lambda-style) function in the PHP. Syntax: string create_function ( $args, $code ) Parameters: This function accepts two parameters which is describes below: $args: It is a string type function argument. $code: 2 min read PHP file_exists( ) Function The file_exists() function in PHP checks whether a file or directory exists on the server. It returns a boolean value:true: If the file or directory exists.false: If the file or directory does not exist or the path is incorrect.Syntax:file_exists($path)In this syntax: The file_exists() function in P 2 min read PHP method_exists() Function The method_exists() function is an inbuilt function in PHP which used to check the class method exists or not. It returns "true" if the method exists otherwise returns "false". Syntax: bool method_exists( object|string $object_or_class, string $method );Parameters: This function accepts two paramete 1 min read PHP key_âexists() Function The key_exists() function is an inbuilt function in PHP that is used to check whether the given key exist in the given array or not. If given key exist in the array then it returns true otherwise returns false. This function is an alias of array_key_exists() function. Syntax: bool key_exists(string| 2 min read PHP interface_exists() Function The interface_exists() function is an inbuilt function in PHP that checks interface is defined or not. Syntax: bool interface_exists(string $interface, bool $autoload = true)Parameters: This function accept two parameters that are described below: $interface: This parameter holds the interface name. 1 min read Like