3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $f = function (string $x): string { return $x; }; try { $f(1); } catch (\TypeError $e) { echo 'Good, $f does not take ints' . PHP_EOL; } \assert(array_map($f, [1, 2, 3]) !== [1, 2, 3]); \assert(array_map($f, [1, 2, 3]) === ['1', '2', '3']); echo 'Huh ???' . PHP_EOL; $p = function (string $_): bool { return false; }; try { $p(1); } catch (\TypeError $e) { echo 'Good, $p does not take ints' . PHP_EOL; } \assert(array_filter([1, 2, 3], $p) === []); echo 'Huh ???' . PHP_EOL; /* http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.strict Strict typing applies to function calls made from within the file with strict typing enabled, not to the functions declared within that file. If a file without strict typing enabled makes a call to a function that was defined in a file with strict typing, the caller's preference (weak typing) will be respected, and the value will be coerced. */

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.70.0170.00316.88
8.3.60.0070.01418.12
8.3.50.0040.01117.94
8.3.40.0060.00918.82
8.3.30.0110.00418.79
8.3.20.0070.00021.73
8.3.10.0000.01018.89
8.3.00.0080.00019.38
8.2.190.0070.00716.75
8.2.180.0070.00725.92
8.2.170.0070.00718.96
8.2.160.0100.00322.96
8.2.150.0080.00025.66
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00819.35
8.2.110.0030.00620.93
8.2.100.0080.00418.03
8.2.90.0050.00317.88
8.2.80.0000.00817.97
8.2.70.0040.00418.04
8.2.60.0030.00618.22
8.2.50.0000.00818.10
8.2.40.0040.00421.07
8.2.30.0050.00219.16
8.2.20.0020.00517.94
8.2.10.0000.00719.45
8.2.00.0040.00418.00
8.1.280.0210.00425.92
8.1.270.0050.00223.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0000.00920.90
8.1.230.0040.00717.76
8.1.220.0060.00317.79
8.1.210.0000.00818.77
8.1.200.0050.00317.35
8.1.190.0040.00417.24
8.1.180.0050.00318.10
8.1.170.0000.00818.64
8.1.160.0040.00418.95
8.1.150.0000.00818.84
8.1.140.0040.00420.19
8.1.130.0000.00717.46
8.1.120.0060.00317.54
8.1.110.0080.00017.46
8.1.100.0050.00317.46
8.1.90.0000.00717.55
8.1.80.0080.00017.43
8.1.70.0080.00017.36
8.1.60.0040.00417.57
8.1.50.0040.00417.50
8.1.40.0040.00417.51
8.1.30.0080.00017.66
8.1.20.0050.00517.68
8.1.10.0030.00517.45
8.1.00.0000.00917.59
8.0.300.0080.00018.77
8.0.290.0030.00616.75
8.0.280.0040.00318.38
8.0.270.0000.00916.89
8.0.260.0000.00716.81
8.0.250.0000.00716.93
8.0.240.0060.00016.97
8.0.230.0000.00716.95
8.0.220.0000.00716.78
8.0.210.0070.00016.89
8.0.200.0000.00616.94
8.0.190.0040.00416.96
8.0.180.0040.00417.02
8.0.170.0040.00417.03
8.0.160.0040.00417.03
8.0.150.0030.00316.93
8.0.140.0050.00216.98
8.0.130.0030.00313.38
8.0.120.0040.00416.93
8.0.110.0050.00316.95
8.0.100.0070.00016.99
8.0.90.0080.00016.99
8.0.80.0060.01016.96
8.0.70.0040.00416.99
8.0.60.0080.00017.00
8.0.50.0070.00016.95
8.0.30.0110.01017.22
8.0.20.0160.01316.95
8.0.10.0050.00217.02
8.0.00.0130.00616.65
7.4.330.0000.00515.55
7.4.320.0060.00316.51
7.4.300.0060.00016.40
7.4.290.0040.00416.65
7.4.280.0040.00416.55
7.4.270.0030.00316.52
7.4.260.0050.00316.59
7.4.250.0000.00716.47
7.4.240.0080.00016.44
7.4.230.0070.00016.62
7.4.220.0050.00316.63
7.4.210.0070.01116.57
7.4.200.0000.00716.70
7.4.160.0080.00716.64
7.4.140.0070.01117.86
7.4.130.0170.00016.52
7.4.120.0030.01916.67
7.4.110.0110.00716.58
7.4.100.0070.01016.38
7.4.90.0120.01116.36
7.4.80.0090.01219.39
7.4.70.0130.00416.73
7.4.60.0130.00316.67
7.4.50.0030.01116.38
7.4.40.0060.01016.62
7.4.00.0080.00915.06
7.3.330.0000.00513.39
7.3.320.0030.00313.20
7.3.310.0000.00816.32
7.3.300.0000.00716.34
7.3.290.0030.00416.32
7.3.280.0060.01016.34
7.3.260.0100.00916.53
7.3.240.0120.00616.38
7.3.230.0070.01016.56
7.3.210.0070.01016.34
7.3.200.0030.01316.66
7.3.190.0090.01116.37
7.3.180.0070.01016.39
7.3.170.0080.01116.46
7.3.160.0060.01216.33
7.3.120.0090.00614.63
7.3.110.0070.01014.73
7.3.100.0060.00614.83
7.3.90.0090.00314.96
7.3.80.0060.00614.88
7.3.70.0080.00314.40
7.3.60.0000.01614.66
7.3.50.0120.00314.62
7.3.40.0000.01114.79
7.3.30.0040.01114.88
7.3.20.0580.00715.12
7.3.10.0410.00715.04
7.3.00.0520.00915.09
7.2.330.0100.00616.83
7.2.320.0120.00616.84
7.2.310.0060.01116.42
7.2.300.0060.01016.63
7.2.290.0140.01116.73
7.2.250.0100.00714.97
7.2.240.0110.00715.27
7.2.230.0030.00715.29
7.2.220.0110.00415.26
7.2.210.0070.00715.02
7.2.200.0000.01114.77
7.2.190.0040.01115.00
7.2.180.0070.00415.11
7.2.170.0030.01014.91
7.2.150.0570.00715.19
7.2.140.0490.00615.26
7.2.130.0450.00815.24
7.2.120.0570.00615.21
7.2.110.0540.00615.19
7.2.100.0550.00815.15
7.2.90.0660.00815.23
7.2.80.0580.00615.28
7.2.70.0500.00815.23
7.2.60.0570.01015.19
7.2.50.0540.00715.21
7.2.40.0600.00615.15
7.2.30.0580.00615.22
7.2.20.0540.00715.23
7.2.10.0610.00615.16
7.2.00.0530.00915.24
7.1.330.0090.00615.77
7.1.320.0100.00715.96
7.1.310.0060.00615.71
7.1.300.0070.01015.82
7.1.290.0060.00615.87
7.1.280.0060.00615.68
7.1.270.0060.00315.81
7.1.260.0070.00715.77
7.1.250.0600.00514.10
7.1.240.0430.01313.89
7.1.230.0520.00914.01
7.1.220.0460.00713.94
7.1.210.0770.01013.88
7.1.200.0450.00713.92
7.1.190.0410.00814.02
7.1.180.0450.00413.95
7.1.170.0500.01013.85
7.1.160.0460.00613.86
7.1.150.0450.00713.87
7.1.140.0580.00414.01
7.1.130.0440.00513.90
7.1.120.0430.00913.73
7.1.110.0420.00713.98
7.1.100.0400.00413.99
7.1.90.0570.00813.96
7.1.80.0510.00614.06
7.1.70.0420.00614.00
7.1.60.0420.00913.83
7.1.50.0420.00913.99
7.1.40.0470.00413.71
7.1.30.0680.00313.89
7.1.20.0490.01014.04
7.1.10.0280.01113.84
7.1.00.0330.00813.92
7.0.330.0470.00313.33
7.0.320.0520.00913.36
7.0.310.0620.00513.50
7.0.300.0410.00513.57
7.0.290.0310.01013.55
7.0.280.0460.00613.47
7.0.270.0670.00713.42
7.0.260.0410.00313.47
7.0.250.0390.00713.54
7.0.240.0480.00513.34
7.0.230.0510.00613.65
7.0.220.0600.00513.54
7.0.210.0430.00613.49
7.0.200.0400.00813.62
7.0.190.0400.01013.59
7.0.180.0530.00813.45
7.0.170.0420.01013.43
7.0.160.0440.00913.54
7.0.150.0160.01013.55
7.0.140.0540.01213.43
7.0.130.0630.00613.61
7.0.120.0480.00513.38
7.0.110.0490.00513.60
7.0.100.0560.00913.61
7.0.90.0500.00513.61
7.0.80.0480.00513.47
7.0.70.0360.00713.38
7.0.60.0490.00813.60
7.0.50.0480.00713.52
7.0.40.0500.00413.70
7.0.30.0620.00713.72
7.0.20.0520.00613.39
7.0.10.0430.00513.58
7.0.00.0450.00913.63
5.6.380.0120.00513.90
5.6.370.0150.00814.04
5.6.360.0140.01114.14
5.6.350.0140.00914.02
5.6.340.0090.00614.06
5.6.330.0090.01114.07
5.6.320.0130.00814.11
5.6.310.0090.00914.12
5.6.300.0110.01514.20
5.6.290.0120.01013.95
5.6.280.0110.01113.94
5.6.270.0080.01114.06
5.6.260.0070.00814.03
5.6.250.0100.00513.98
5.6.240.0100.00713.99
5.6.230.0140.01114.08
5.6.220.0080.00914.11
5.6.210.0070.00814.11
5.6.200.0140.00614.04
5.6.190.0070.00614.15
5.6.180.0120.00814.13
5.6.170.0090.00714.10
5.6.160.0150.00514.04
5.6.150.0060.00814.12
5.6.140.0090.00814.02
5.6.130.0120.00613.92
5.6.120.0070.01214.12
5.6.110.0080.00714.10
5.6.100.0100.01014.02
5.6.90.0100.00513.88
5.6.80.0130.00714.07
5.6.70.0110.01213.88
5.6.60.0120.00614.04
5.6.50.0110.00513.94
5.6.40.0070.01014.05
5.6.30.0110.00613.97
5.6.20.0110.00713.96
5.6.10.0060.01214.10
5.6.00.0050.01013.99
5.5.380.0080.00910.82
5.5.370.0090.00310.83
5.5.360.0090.00310.97
5.5.350.0050.01010.87
5.5.340.0090.00310.88
5.5.330.0070.00610.71
5.5.320.0100.00510.99
5.5.310.0070.00610.81
5.5.300.0080.00510.83
5.5.290.0100.00410.75
5.5.280.0090.00610.90
5.5.270.0040.00710.99
5.5.260.0070.00710.81
5.5.250.0030.00710.86
5.5.240.0090.00510.81
5.5.230.0090.00410.84
5.5.220.0060.00410.75
5.5.210.0040.00910.85
5.5.200.0100.00410.77
5.5.190.0100.00310.79
5.5.180.0050.00910.90
5.5.170.0110.00410.78
5.5.160.0080.00810.80
5.5.150.0060.00610.84
5.5.140.0130.00510.75
5.5.130.0100.00410.82
5.5.120.0080.00510.75
5.5.110.0100.00410.83
5.5.100.0050.01210.70
5.5.90.0050.00610.85
5.5.80.0110.00310.77
5.5.70.0070.00610.85
5.5.60.0070.00610.63
5.5.50.0070.00410.79
5.5.40.0050.00410.79
5.5.30.0080.00710.87
5.5.20.0110.00310.81
5.5.10.0100.00310.56
5.5.00.0070.00410.74
5.4.450.0040.00910.73
5.4.440.0090.00210.89
5.4.430.0080.00410.79
5.4.420.0090.00410.83
5.4.410.0090.00410.73
5.4.400.0130.00010.72
5.4.390.0080.00210.75
5.4.380.0070.00410.73
5.4.370.0070.00710.63
5.4.360.0060.00510.75
5.4.350.0080.00610.75
5.4.340.0070.00710.81
5.4.330.0070.00310.57
5.4.320.0070.00610.75
5.4.310.0070.00710.80
5.4.300.0110.00210.79
5.4.290.0080.00510.95
5.4.280.0050.00810.77
5.4.270.0090.00310.80
5.4.260.0060.00510.69
5.4.250.0040.00710.80
5.4.240.0050.00810.81
5.4.230.0110.00210.50
5.4.220.0070.00510.71
5.4.210.0070.00610.50
5.4.200.0100.00210.65
5.4.190.0090.00410.64
5.4.180.0100.00710.52
5.4.170.0070.00410.70
5.4.160.0090.00510.51
5.4.150.0070.00610.63
5.4.140.0050.00710.67
5.4.130.0020.00710.65
5.4.120.0060.00910.57
5.4.110.0020.00710.74
5.4.100.0100.00410.62
5.4.90.0100.00510.83
5.4.80.0020.00710.77
5.4.70.0080.00410.77
5.4.60.0060.00610.65
5.4.50.0050.00810.66
5.4.40.0070.00310.80
5.4.30.0090.00610.85
5.4.20.0060.00510.81
5.4.10.0050.00810.70
5.4.00.0070.00410.57
5.3.290.0070.00310.38
5.3.280.0060.00410.18
5.3.270.0020.00810.29
5.3.260.0080.00410.25
5.3.250.0070.00410.21
5.3.240.0030.00810.06
5.3.230.0090.0059.98
5.3.220.0050.00710.22
5.3.210.0080.00510.01
5.3.200.0040.00710.14
5.3.190.0130.00110.17
5.3.180.0070.00710.13
5.3.170.0040.00710.31
5.3.160.0090.00110.22
5.3.150.0050.00510.27
5.3.140.0080.00610.36
5.3.130.0080.00610.28
5.3.120.0090.00710.38
5.3.110.0080.00910.34
5.3.100.0090.00510.30
5.3.90.0090.00510.46
5.3.80.0080.00410.01
5.3.70.0110.00310.23
5.3.60.0080.00610.28
5.3.50.0060.00510.27
5.3.40.0090.00210.21
5.3.30.0130.00310.22
5.3.20.0080.00410.18
5.3.10.0070.00510.02
5.3.00.0110.00210.00
5.2.170.0080.0059.06
5.2.160.0060.0049.31
5.2.150.0070.0039.12
5.2.140.0060.0039.18
5.2.130.0060.0019.10
5.2.120.0070.0079.15
5.2.110.0040.0059.21
5.2.100.0050.0049.21
5.2.90.0060.0049.16
5.2.80.0060.0049.01
5.2.70.0080.0028.90
5.2.60.0050.0069.07
5.2.50.0040.0079.06
5.2.40.0080.0029.00
5.2.30.0100.0059.16
5.2.20.0110.0038.85
5.2.10.0070.0038.87
5.2.00.0070.0048.91
5.1.60.0060.0028.20
5.1.50.0040.0038.22
5.1.40.0060.0048.27
5.1.30.0030.0068.45
5.1.20.0050.0058.29
5.1.10.0060.0028.18
5.1.00.0060.0048.00
5.0.50.0020.0067.69
5.0.40.0040.0047.69
5.0.30.0080.0027.69
5.0.20.0030.0047.69
5.0.10.0040.0037.69
5.0.00.0050.0057.69
4.4.90.0010.0047.69
4.4.80.0050.0027.69
4.4.70.0050.0037.69
4.4.60.0020.0037.69
4.4.50.0030.0047.69
4.4.40.0030.0037.69
4.4.30.0050.0007.69
4.4.20.0030.0037.69
4.4.10.0040.0047.69
4.4.00.0030.0037.69
4.3.110.0070.0027.69
4.3.100.0030.0027.69
4.3.90.0010.0047.69
4.3.80.0040.0007.69
4.3.70.0020.0057.69
4.3.60.0050.0017.69
4.3.50.0020.0037.69
4.3.40.0030.0027.69
4.3.30.0000.0047.69
4.3.20.0020.0057.69
4.3.10.0030.0047.69
4.3.00.0020.0037.69

preferences:
68.95 ms | 401 KiB | 5 Q