To check a function exist or not in PHP we use a built-in function function_exists(). This function check that the function exists or not.
Syntax:
function_exists(function_name);
It includes one parameter i.e., the name of the function which you want to check. It returns true if the function exists else returns false.
For example:
<?php
function myrow()
{
return 1;
}
if (function_exists('myrow')) {
echo "myrow function exist.<br />";
} else {
echo "myrow function does not exist.<br />";
}
?>
The output of the above code is:
myrow function exist.
0 Comment(s)