- is_callable: documentation ( source)
<?php
function test($var) {
echo "Testing: $var\n";
}
class foo {
var $arr = array("test");
function bar($str) {
if ( is_callable( $this->arr[0] ) ){
echo $this->arr[0]($str);
}
}
}
$foo = new foo;
$foo->bar("bla"); // Testing bla