3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function foo() { echo(__METHOD__); } public static function bar() { echo (__METHOD__); } } $foo = new Foo; $result = []; var_dump(is_callable(['Foo', 'foo'], 0, $result[0]));//false var_dump(is_callable(['Foo', 'bar'], 0, $result[1]));//true var_dump(is_callable([$foo, 'foo'], 0, $result[2]));//true var_dump(is_callable([$foo, 'bar'], 0, $result[3]));//true var_dump($result); array_map('call_user_func', $result);
Output for git.master, git.master_jit, rfc.property-hooks
bool(false) bool(true) bool(true) bool(true) array(4) { [0]=> string(8) "Foo::foo" [1]=> string(8) "Foo::bar" [2]=> string(8) "Foo::foo" [3]=> string(8) "Foo::bar" } Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method Foo::foo() cannot be called statically in /in/vsv9u:15 Stack trace: #0 [internal function]: call_user_func('Foo::foo') #1 /in/vsv9u(15): array_map('call_user_func', Array) #2 {main} thrown in /in/vsv9u on line 15
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
37.55 ms | 402 KiB | 8 Q