Cú pháp giống của is_callable và call_user_func có thể dùng để truyền phương thức static làm tham số trong PHP.
Để truyền phương thức static, ví dụ dưới đây:
Ví dụ
<?php
function my_func() {
echo "Hello there!";
}
$variable_name = "my_func";
var_dump(is_callable($variable_name, false, $callable_name));
echo $callable_name, "\n";
var_dump(is_callable($variable_name));
?>
Kết quả
bool(true) my_func bool(true)