3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public function doStuff(){ } } function doSomething(callable $param) { var_dump($param); } doSomething(['MyClass', 'doStuff']);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: doSomething(): Argument #1 ($param) must be of type callable, array given, called in /in/E0YJ3 on line 12 and defined in /in/E0YJ3:8 Stack trace: #0 /in/E0YJ3(12): doSomething(Array) #1 {main} thrown in /in/E0YJ3 on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Deprecated: Non-static method MyClass::doStuff() should not be called statically in /in/E0YJ3 on line 8 array(2) { [0]=> string(7) "MyClass" [1]=> string(7) "doStuff" }
Output for 7.3.32 - 7.3.33, 7.4.26
array(2) { [0]=> string(7) "MyClass" [1]=> string(7) "doStuff" }
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Strict Standards: Non-static method MyClass::doStuff() should not be called statically in /in/E0YJ3 on line 8 array(2) { [0]=> string(7) "MyClass" [1]=> string(7) "doStuff" }

preferences:
246.3 ms | 402 KiB | 378 Q