is_callable_basic1.phpt [plain text]
--TEST--
Test is_callable() function : usage variations - defined functions
--INI--
precision=14
error_reporting = E_ALL & ~E_NOTICE | E_STRICT
--FILE--
<?php
function check_iscallable( $functions ) {
$counter = 1;
foreach($functions as $func) {
echo "-- Iteration $counter --\n";
var_dump( is_callable($func) ); var_dump( is_callable($func, TRUE) ); var_dump( is_callable($func, TRUE, $callable_name) );
echo $callable_name, "\n";
var_dump( is_callable($func, FALSE) ); var_dump( is_callable($func, FALSE, $callable_name) );
echo $callable_name, "\n";
$counter++;
}
}
echo "\n*** Testing is_callable() on defined functions ***\n";
function someFunction() {
}
function x123() {
}
function NULL() {
}
function false() {
}
function Hello_World() {
}
$defined_functions = array (
$functionVar1 = 'someFunction',
$functionVar2 = 'x123',
$functionVar3 = 'NULL',
$functionVar4 = 'false',
$functionVar5 = "Hello_World"
);
check_iscallable($defined_functions);
?>
===DONE===
--EXPECT--
*** Testing is_callable() on defined functions ***
-- Iteration 1 --
bool(true)
bool(true)
bool(true)
someFunction
bool(true)
bool(true)
someFunction
-- Iteration 2 --
bool(true)
bool(true)
bool(true)
x123
bool(true)
bool(true)
x123
-- Iteration 3 --
bool(true)
bool(true)
bool(true)
NULL
bool(true)
bool(true)
NULL
-- Iteration 4 --
bool(true)
bool(true)
bool(true)
false
bool(true)
bool(true)
false
-- Iteration 5 --
bool(true)
bool(true)
bool(true)
Hello_World
bool(true)
bool(true)
Hello_World
===DONE===