3v4l.org

run code in 300+ PHP versions simultaneously
<?php // declare(strict_types=1); namespace Test\Biz; //error_reporting(-1); class Foo { public function bar($value) { if (\is_callable($value)) { return $this->baz($value); } } public function baz(callable $callable) { return $callable; } } function demonstrate2(callable $callable) { return $callable; } echo (new Foo())->bar('\Test\Biz\Foo::bar'); demonstrate2('\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
\Test\Biz\Foo::bar Fatal error: Uncaught TypeError: Test\Biz\demonstrate2(): Argument #1 ($callable) must be of type callable, string given, called in /in/XMiVr on line 29 and defined in /in/XMiVr:23 Stack trace: #0 /in/XMiVr(29): Test\Biz\demonstrate2('\\Test\\Biz\\Foo::...') #1 {main} thrown in /in/XMiVr on line 23
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
\Test\Biz\Foo::bar Deprecated: Non-static method Test\Biz\Foo::bar() should not be called statically in /in/XMiVr on line 23
Output for 7.3.32 - 7.3.33
\Test\Biz\Foo::bar

preferences:
84.97 ms | 411 KiB | 5 Q