function_exists method_exists is_callable 区别和简单实例

function_exists() 判断非类的函数是否存在
method_exists() 判断类中是否存在某个方法
is_callable() 判断一个函数或方案是否可以被调用

function aa(){}
function_exists('aa');//true

class abc{
public static $a =1;
private function ab(){
}
}
$o = new abc();
var_dump(is_callable(['abc','ab']));//false
var_dump(method_exists($o,'ab'));//true


原文地址:https://www.cnblogs.com/jinshao/p/13264397.html