How to check whether a function exists in php: You can use the function_exists() function to judge. Returns true if the function exists, false otherwise. The specific usage method is: [function_exists('curl_init')].
The function_exists() function determines whether the given function has been defined. If function_name exists and is indeed a function, it returns TRUE , otherwise it returns FALSE .
(Recommended tutorial: php graphic tutorial)
Syntax:
function_exists ( string $function_name ) : bool
Note: function_name must be a string.
(Video tutorial recommendation: php video tutorial)
Code implementation:
if(function_exists('curl_init')){ curl_init(); }else{ echo 'not function curl_init'; }
The above is the detailed content of How to check if a function exists in php. For more information, please follow other related articles on the PHP Chinese website!