码迷,mamicode.com
首页 > 其他好文 > 详细

function_exists method_exists is_callable 区别和简单实例

时间:2020-07-08 00:55:55      阅读:60      评论:0      收藏:0      [点我收藏+]

标签:method   vat   存在   单实例   public   实例   stat   fun   var   

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

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

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


function_exists method_exists is_callable 区别和简单实例

标签:method   vat   存在   单实例   public   实例   stat   fun   var   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!