3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Test\Biz; class Foo { public function bar(callable $callable) { echo $callable; } } function demonstrate2(callable $callable) { } echo 'Function: '; echo demonstrate2('\Test\Biz\Foo::bar'); echo PHP_EOL . 'Method: '; (new Foo())->bar('\Test\Biz\Foo::bar');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
Function: Fatal error: Uncaught TypeError: Test\Biz\demonstrate2(): Argument #1 ($callable) must be of type callable, string given, called in /in/4ibt7 on line 17 and defined in /in/4ibt7:13 Stack trace: #0 /in/4ibt7(17): Test\Biz\demonstrate2('\\Test\\Biz\\Foo::...') #1 {main} thrown in /in/4ibt7 on line 13
Process exited with code 255.
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Function: Deprecated: Non-static method Test\Biz\Foo::bar() should not be called statically in /in/4ibt7 on line 13 Method: \Test\Biz\Foo::bar
Output for 7.3.32 - 7.3.33
Function: Method: \Test\Biz\Foo::bar

preferences:
77.26 ms | 408 KiB | 5 Q