3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Filter { // A constructor in PHP 4 and 5 function __construct(int $a) { echo $a; } } $o1 = new Filter(5); $o2 = new Filter('a');
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
5 Fatal error: Uncaught TypeError: Filter::__construct(): Argument #1 ($a) must be of type int, string given, called in /in/HR4cS on line 11 and defined in /in/HR4cS:5 Stack trace: #0 /in/HR4cS(11): Filter->__construct('a') #1 {main} thrown in /in/HR4cS on line 5
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
5 Fatal error: Uncaught TypeError: Argument 1 passed to Filter::__construct() must be of the type int, string given, called in /in/HR4cS on line 11 and defined in /in/HR4cS:5 Stack trace: #0 /in/HR4cS(11): Filter->__construct('a') #1 {main} thrown in /in/HR4cS on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
5 Fatal error: Uncaught TypeError: Argument 1 passed to Filter::__construct() must be of the type integer, string given, called in /in/HR4cS on line 11 and defined in /in/HR4cS:5 Stack trace: #0 /in/HR4cS(11): Filter->__construct('a') #1 {main} thrown in /in/HR4cS on line 5
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Catchable fatal error: Argument 1 passed to Filter::__construct() must be an instance of int, integer given, called in /in/HR4cS on line 10 and defined in /in/HR4cS on line 5
Process exited with code 255.

preferences:
162.71 ms | 402 KiB | 215 Q