3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ "k0"=>"v0", "k1"=>"v1", "k2"=>"v2", "k3"=>"v3", "k4"=>"v4", ]; $result_1 = []; while (key($data)) { $result_1[key($data)] = current($data); next($data); } print_r($result_1); //Then perform the same operation in a function supplying the same array $data as argument //(mind that the internal pointer of $data is at the end): traverse($data); function traverse($arr){ $result_2 = []; while (key($arr)) { $result_2[key($arr)] = current($arr); next($arr); } print_r($result_2); }

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.0110.00716.39
8.3.60.0110.00718.31
8.3.50.0060.00918.04
8.3.40.0120.00918.69
8.3.30.0110.00418.75
8.3.20.0030.00518.71
8.3.10.0040.00423.52
8.3.00.0000.00821.37
8.2.180.0070.00716.49
8.2.170.0100.00622.96
8.2.160.0070.00720.39
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0040.01126.16
8.2.120.0030.00521.21
8.2.110.0040.00420.93
8.2.100.0090.00317.89
8.2.90.0000.00817.84
8.2.80.0050.00318.05
8.2.70.0000.00818.03
8.2.60.0060.00318.22
8.2.50.0040.00418.10
8.2.40.0040.00419.30
8.2.30.0050.00219.39
8.2.20.0030.00618.07
8.2.10.0050.00219.30
8.2.00.0060.00317.63
8.1.280.0070.00725.92
8.1.270.0060.00323.83
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0000.00923.84
8.1.230.0150.00020.87
8.1.220.0090.00017.74
8.1.210.0030.00618.77
8.1.200.0090.00317.23
8.1.190.0000.00817.13
8.1.180.0080.00018.10
8.1.170.0040.00418.51
8.1.160.0000.00718.87
8.1.150.0040.00418.86
8.1.140.0040.00422.13
8.1.130.0050.00317.36
8.1.120.0040.00417.30
8.1.110.0040.00417.39
8.1.100.0040.00417.40
8.1.90.0080.00017.39
8.1.80.0040.00417.33
8.1.70.0040.00417.31
8.1.60.0030.00617.62
8.1.50.0000.00817.48
8.1.40.0050.00317.54
8.1.30.0000.00917.63
8.1.20.0000.00817.57
8.1.10.0040.00417.48
8.1.00.0020.00517.51
8.0.300.0080.00019.66
8.0.290.0060.00316.63
8.0.280.0030.00318.38
8.0.270.0070.00016.77
8.0.260.0060.00016.67
8.0.250.0000.00916.89
8.0.240.0030.00316.78
8.0.230.0030.00316.90
8.0.220.0000.00716.84
8.0.210.0070.00016.81
8.0.200.0030.00316.82
8.0.190.0000.00816.77
8.0.180.0050.00316.86
8.0.170.0060.00316.91
8.0.160.0040.00416.84
8.0.150.0000.00716.65
8.0.140.0000.00716.73
8.0.130.0000.00513.32
8.0.120.0000.00716.82
8.0.110.0050.00216.75
8.0.100.0000.00716.89
8.0.90.0000.00716.86
8.0.80.0050.00916.83
8.0.70.0040.00416.68
8.0.60.0000.00816.83
8.0.50.0070.00016.70
8.0.30.0120.00517.09
8.0.20.0060.01417.40
8.0.10.0040.00416.77
8.0.00.0110.00916.76
7.4.330.0000.00515.55
7.4.320.0000.00616.36
7.4.300.0000.00616.59
7.4.290.0070.00016.58
7.4.280.0060.00316.43
7.4.270.0070.00016.60
7.4.260.0040.00416.63
7.4.250.0000.00716.55
7.4.240.0000.00816.53
7.4.230.0030.00316.50
7.4.220.0040.00416.49
7.4.210.0100.00716.61
7.4.200.0050.00216.43
7.4.160.0090.00816.46
7.4.140.0150.00617.86
7.4.130.0120.00616.50
7.4.120.0080.01416.51
7.4.110.0140.00316.58
7.4.100.0100.00716.54
7.4.90.0040.01316.58
7.4.80.0080.01119.39
7.4.70.0110.00716.42
7.4.60.0130.00316.37
7.4.50.0090.00616.41
7.4.40.0140.00316.53
7.4.00.0080.00415.05
7.3.330.0000.00513.38
7.3.320.0000.00513.32
7.3.310.0030.00516.29
7.3.300.0000.00716.27
7.3.290.0040.00416.17
7.3.280.0080.00816.29
7.3.260.0140.00616.30
7.3.240.0080.01216.31
7.3.230.0130.00416.27
7.3.210.0060.01016.30
7.3.200.0090.00916.21
7.3.190.0060.01516.27
7.3.180.0060.01016.59
7.3.170.0180.00016.31
7.3.160.0060.00916.29
7.3.70.0110.00414.71
7.3.60.0030.01114.58
7.3.50.0100.01014.79
7.3.40.0090.01214.66
7.3.30.0030.01014.62
7.3.20.0030.01016.73
7.3.10.0040.00916.46
7.3.00.0090.00616.77
7.2.330.0120.01216.61
7.2.320.0130.01016.21
7.2.310.0040.01416.61
7.2.300.0060.01016.67
7.2.290.0100.00716.39
7.2.200.0060.01314.61
7.2.190.0060.01014.97
7.2.180.0090.00614.92
7.2.170.0110.01214.88
7.2.160.0060.00914.81
7.2.150.0000.01216.68
7.2.140.0120.00316.68
7.2.130.0030.01016.63
7.2.120.0060.00916.72
7.2.110.1090.00915.27
7.2.100.1450.00515.39
7.2.90.1170.00815.27
7.2.80.1270.00515.20
7.2.70.1430.00515.52
7.2.60.1360.00915.53
7.2.50.1150.01015.65
7.2.40.1150.00815.50
7.2.30.1340.00715.55
7.2.20.1300.00615.60
7.2.10.1300.00615.59
7.2.00.0870.00915.60
7.1.300.0110.00315.93
7.1.290.0070.01015.84
7.1.280.0060.00615.65
7.1.270.0090.00315.66
7.1.260.0090.00915.68
7.1.250.0030.00915.66
7.1.240.0120.00415.35
7.1.230.1190.00514.45
7.1.220.1140.00914.54
7.1.210.1240.00614.51
7.1.200.1330.00714.51
7.1.190.1280.00414.45
7.1.180.1280.00614.53
7.1.170.1330.00714.44
7.1.160.1190.00614.46
7.1.150.1150.00614.45
7.1.140.1140.00914.54
7.1.130.1280.00714.61
7.1.120.1000.00514.51
7.1.110.1010.00614.54
7.1.100.0840.01014.58
7.1.90.0640.01114.63
7.1.80.0970.00414.62
7.1.70.0610.00914.53
7.1.60.0850.00828.87
7.1.50.0590.01228.86
7.1.40.0730.00728.94
7.1.30.0860.00528.93
7.1.20.0770.00828.77
7.1.10.0690.00514.65
7.1.00.0540.00714.65
7.0.330.0120.01214.98
5.6.400.0220.00314.02
5.6.390.0070.01013.86
5.6.380.0110.00714.21

preferences:
69.81 ms | 401 KiB | 5 Q