3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function bar() { echo (__METHOD__); } public function baz() { echo(__METHOD__); } } $foo = new Foo; $result = []; var_dump(is_callable(['Foo', 'baz'], 0, $result[0]));//false var_dump(is_callable(['Foo', 'bar'], 0, $result[1]));//true var_dump(is_callable([$foo, 'baz'], 0, $result[2]));//true var_dump(is_callable([$foo, 'bar'], 0, $result[3]));//true array_map('call_user_func', $result);
Output for git.master, git.master_jit, rfc.property-hooks
bool(false) bool(true) bool(true) bool(true) Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method Foo::baz() cannot be called statically in /in/KADkp:14 Stack trace: #0 [internal function]: call_user_func('Foo::baz') #1 /in/KADkp(14): array_map('call_user_func', Array) #2 {main} thrown in /in/KADkp on line 14
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:
43.41 ms | 401 KiB | 8 Q