How can I check if the function my_function already exists in PHP?
Checking Multiple function_exists
$arrFun = array('fun1','fun2','fun3');
if(is_array($arrFun)){
$arrMsg = array();
foreach ($arrFun as $key => $value) {
if(!function_exists($value)){
$arrMsg[] = $value;
}
}
foreach ($arrMsg as $key => $value) {
echo "{$value} function does not exist
";
}
}
function fun1(){
}
Output
fun2 function does not exist
fun3 function does not exist