3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* function has_next($array) { return next($array) === false && key($array) === null ? false : true; } */ $array1 = [ "one" => 1, "two" => 2, "three" => 3, "four" => 4 ]; while (current($array1)!==false) { $current = current($array1); $key = key($array1); echo "$key => $current\n"; if ($current < 2) { $array1[$key] = ++$current; } else { next($array1); } }

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.60.0120.00318.18
8.3.50.0190.00316.38
8.3.40.0160.00018.54
8.3.30.0130.00318.54
8.3.20.0040.00421.83
8.3.10.0000.00823.65
8.3.00.0040.00422.08
8.2.180.0090.01318.06
8.2.170.0110.00322.96
8.2.160.0090.00619.04
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0070.00019.34
8.2.120.0070.00026.35
8.2.110.0030.00620.38
8.2.100.0040.00819.51
8.2.90.0000.00917.88
8.2.80.0000.00818.73
8.2.70.0040.00417.75
8.2.60.0030.00617.50
8.2.50.0050.00218.05
8.2.40.0030.00519.48
8.2.30.0040.00417.85
8.2.20.0000.00717.98
8.2.10.0050.00218.12
8.2.00.0000.00818.11
8.1.280.0110.00725.92
8.1.270.0040.00422.07
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0120.00623.75
8.1.230.0110.00017.77
8.1.220.0000.00917.74
8.1.210.0040.00418.77
8.1.200.0050.00317.35
8.1.190.0030.00717.22
8.1.180.0050.00318.10
8.1.170.0000.00817.62
8.1.160.0080.00018.81
8.1.150.0050.00319.01
8.1.140.0000.00717.63
8.1.130.0000.00718.99
8.1.120.0070.00017.43
8.1.110.0080.00017.33
8.1.100.0000.00717.29
8.1.90.0040.00417.31
8.1.80.0040.00417.40
8.1.70.0000.00817.40
8.1.60.0000.00817.55
8.1.50.0040.00417.38
8.1.40.0050.00317.45
8.1.30.0000.00817.54
8.1.20.0030.00517.59
8.1.10.0040.00417.46
8.1.00.0000.00817.51
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0070.00018.05
8.0.270.0000.00718.00
8.0.260.0000.00816.75
8.0.250.0000.00616.89
8.0.240.0000.00917.03
8.0.230.0070.00016.98
8.0.220.0030.00316.90
8.0.210.0070.00016.84
8.0.200.0070.00316.97
8.0.190.0000.00916.95
8.0.180.0050.00216.84
8.0.170.0030.00516.88
8.0.160.0000.00816.78
8.0.150.0000.00816.78
8.0.140.0000.00816.73
8.0.130.0030.00313.35
8.0.120.0000.00716.83
8.0.110.0050.00216.95
8.0.100.0000.00716.69
8.0.90.0000.00816.82
8.0.80.0060.01016.92
8.0.70.0040.00416.93
8.0.60.0040.00416.76
8.0.50.0000.00716.77
8.0.30.0100.00616.96
8.0.20.0120.00617.40
8.0.10.0000.00716.75
8.0.00.0090.00916.86
7.4.330.0030.00315.55
7.4.320.0030.00316.54
7.4.300.0000.00616.48
7.4.290.0020.00516.34
7.4.280.0040.00416.58
7.4.270.0000.00716.49
7.4.260.0030.00316.57
7.4.250.0070.00016.41
7.4.240.0070.00016.51
7.4.230.0080.00016.48
7.4.220.0070.00016.39
7.4.210.0070.00716.66
7.4.200.0000.00716.69
7.4.160.0090.00716.49
7.4.140.0140.00517.86
7.4.130.0110.01216.43
7.4.120.0090.01116.56
7.4.110.0150.00916.56
7.4.100.0070.01016.47
7.4.90.0060.01616.38
7.4.80.0190.00619.39
7.4.70.0100.00616.50
7.4.60.0120.00316.61
7.4.50.0000.01216.38
7.4.40.0110.00616.41
7.4.00.0080.00815.11
7.3.330.0040.00413.07
7.3.320.0060.00013.05
7.3.310.0030.00316.26
7.3.300.0030.00316.35
7.3.290.0080.00716.34
7.3.280.0090.00716.30
7.3.260.0030.01416.41
7.3.240.0100.00916.41
7.3.230.0120.00616.41
7.3.210.0130.00316.21
7.3.200.0120.00916.47
7.3.190.0080.00816.54
7.3.180.0070.01016.38
7.3.170.0090.00616.45
7.3.160.0030.01716.54
7.2.330.0140.00416.75
7.2.320.0000.01716.44
7.2.310.0110.00716.61
7.2.300.0120.00616.76
7.2.290.0110.00716.52
7.2.60.0080.00316.75
7.2.30.0190.01117.96
7.2.20.0190.01317.48
7.2.10.0180.01417.75
7.2.00.0130.01317.82
7.1.200.0000.00915.81
7.1.150.0140.00916.73
7.1.140.0190.01316.61
7.1.130.0150.01417.16
7.1.120.0180.00816.49
7.1.110.0130.01016.51
7.1.100.0320.00816.04
7.1.90.0140.01016.06
7.1.80.0100.01015.93
7.1.70.0130.00915.28
7.1.60.0310.00933.16
7.1.50.0310.01732.78
7.1.40.0250.01232.66
7.1.30.0270.01332.73
7.1.20.0240.01532.97
7.1.10.0050.01414.81
7.1.00.0120.01314.77

preferences:
58.95 ms | 401 KiB | 5 Q