In PHP, how do I check if a function exists?
Using function_exists
:
if(function_exists('my_function')){
// my_function is defined
}
http://php.net/manual/en/function.function-exists.php
<?php
if (!function_exists('myfunction')) {
function myfunction()
{
//write function statements
}
}
?>
var_dump( get_defined_functions() );
DISPLAYS all existing functions