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