3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in /in/vsv9u on line 3 Foo::foobool(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" } Warning: call_user_func() expects parameter 1 to be a valid callback, non-static method Foo::foo() cannot be called statically in /in/vsv9u on line 15 Foo::bar Warning: call_user_func() expects parameter 1 to be a valid callback, non-static method Foo::foo() cannot be called statically in /in/vsv9u on line 15 Foo::bar
Output for Array change keys
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in /in/vsv9u on line 3 Foo::foobool(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" } Warning: call_user_func() expects parameter 1 to be a valid callback, non-static method Foo::foo() cannot be called statically in /in/vsv9u on line 15 Foo::bar Warning: call_user_func() expects parameter 1 to be a valid callback, non-static method Foo::foo() cannot be called statically in /in/vsv9u on line 15 Foo::bar
Output for Lexical anon
Foo::foobool(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" } Warning: call_user_func() expects parameter 1 to be a valid callback, non-static method Foo::foo() cannot be called statically in /in/vsv9u on line 15 Foo::bar Warning: call_user_func() expects parameter 1 to be a valid callback, non-static method Foo::foo() cannot be called statically in /in/vsv9u on line 15 Foo::bar

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