3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function bar() { } public static function barS() { } } function x() { } print_r(Closure::fromCallable([new Foo(), 'bar'])); print_r(Closure::fromCallable([Foo::class, 'barS'])); print_r(x(...));
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected ')' in /in/s8HvF on line 16
Process exited with code 255.
Output for 8.0.1 - 8.0.21
Parse error: syntax error, unexpected token ")" in /in/s8HvF on line 16
Process exited with code 255.
Output for 8.1.0 - 8.1.34
Closure Object ( [this] => Foo Object ( ) ) Closure Object ( ) Closure Object ( )
Output for 8.2.22 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
Closure Object ( [function] => Foo::bar [this] => Foo Object ( ) ) Closure Object ( [function] => Foo::barS ) Closure Object ( [function] => x )

preferences:
36.36 ms | 1147 KiB | 13 Q