- is_callable: documentation ( source)
<?php
class myClass {
static function baz($var) {
echo "Oh the $var of it!\n";
}
}
(new class {
public $arr = ["baz"];
function test( $arg ){
if( is_callable( $this->arr[0],true ) ){
(myClass::$this->arr[0])( $arg );
}
}
})->test("joy");