function_exists()
function_exists — Return TRUE if the given function has been defined
Syntax
bool function_exists ( string $function_name )
Example
<!DOCTYPE HTML> <html> <head> <title>php function_exists</title> </head> <body> <?php function testFunction () { echo " hello from function"; } if (function_exists('testFunction')) { echo "function already exists"; testFunction(); } else { echo "creating testFunction() first time"; } ?> </body> </html>
Output
function already exists hello from function