Source Code:
(back to article)
<?php function testFunction() { echo "Hello world!"; } class TestClass { public function testMethod() { echo "Hello world!"; } } $var1 = "testFunction"; $var2 = [new TestClass(), "testMethod"]; $var3 = "not_a_callable"; echo is_callable($var1) . "\n"; // output: 1 (true) echo is_callable($var2) . "\n"; // output: 1 (true) echo is_callable($var3) . "\n"; // output: (false) ?>
Result:
Report an issue