(PHP 4 >= 4.0.6, PHP 5, PHP 7)
is_callable — 锟斤拷锟斤拷锟斤拷锟角凤拷为锟较凤拷锟侥可碉拷锟矫结构
锟斤拷证锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟杰凤拷锟斤拷为锟斤拷锟斤拷锟斤拷锟矫★拷 锟斤拷锟斤拷约锟斤拷锟斤拷锟斤拷锟叫э拷锟斤拷锟斤拷锟斤拷谋锟斤拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟斤拷锟斤拷椋拷锟斤拷锟斤拷锟斤拷锟饺凤拷锟斤拷锟侥讹拷锟斤拷锟皆硷拷锟斤拷锟斤拷锟斤拷锟斤拷
name
要锟斤拷锟侥回碉拷锟斤拷锟斤拷锟斤拷
syntax_only
锟斤拷锟斤拷锟斤拷锟轿� TRUE
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街� name
锟斤拷锟斤拷锟角猴拷锟斤拷锟津方凤拷锟斤拷
锟斤拷锟斤拷锟斤拷锟杰撅拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷未锟斤拷锟斤拷锟斤拷锟斤拷锟节回碉拷锟斤拷锟斤拷锟斤拷锟斤拷效锟结构锟斤拷锟斤拷效锟斤拷应锟矫帮拷锟斤拷锟斤拷锟斤拷元锟截o拷锟斤拷一锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷诙锟斤拷锟皆拷锟斤拷歉锟斤拷址锟斤拷锟�
callable_name
锟斤拷锟斤拷"锟缴碉拷锟矫碉拷锟斤拷锟斤拷"锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�"someClass::someMethod"锟斤拷 注锟解,锟斤拷锟斤拷 someClass::SomeMethod() 锟侥猴拷锟斤拷锟角可碉拷锟矫的撅拷态锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟接碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷摹锟�
锟斤拷锟� name
锟缴碉拷锟斤拷锟津返伙拷 TRUE
锟斤拷锟斤拷锟津返伙拷 FALSE
锟斤拷
Example #1 is_callable() 锟斤拷锟斤拷
<?php
// How to check a variable to see if it can be called
// as a function.
//
// Simple variable containing a function
//
function someFunction()
{
}
$functionVariable = 'someFunction';
var_dump(is_callable($functionVariable, false, $callable_name)); // bool(true)
echo $callable_name, "\n"; // someFunction
//
// Array containing a method
//
class someClass {
function someMethod()
{
}
}
$anObject = new someClass();
$methodVariable = array($anObject, 'someMethod');
var_dump(is_callable($methodVariable, true, $callable_name)); // bool(true)
echo $callable_name, "\n"; // someClass::someMethod
?>