3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Cheese { public function foo($bar, int $baz) { echo $baz; } } (new Cheese())->foo('bar');
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Cheese::foo(), 1 passed in /in/dtTLm on line 13 and exactly 2 expected in /in/dtTLm:7 Stack trace: #0 /in/dtTLm(13): Cheese->foo('bar') #1 {main} thrown in /in/dtTLm on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Argument 2 passed to Cheese::foo() must be of the type integer, none given, called in /in/dtTLm on line 13 and defined in /in/dtTLm:7 Stack trace: #0 /in/dtTLm(13): Cheese->foo('bar') #1 {main} thrown in /in/dtTLm on line 7
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/dtTLm on line 3 Catchable fatal error: Argument 2 passed to Cheese::foo() must be an instance of int, none given, called in /in/dtTLm on line 13 and defined in /in/dtTLm on line 7
Process exited with code 255.

preferences:
199.64 ms | 402 KiB | 240 Q