3v4l.org

run code in 300+ PHP versions simultaneously
<?php $headers = array( 'one', 'two', 'three', ); $data = array( 'three' => 'someva3', 'one' => 'someval1', 'two' => 'someval2' ); $expected = array( 'someval1', 'someval2', 'someval3' ); $positions = array_flip($headers); $output = array(); foreach($data as $key => $item) { $position = $positions[$key]; $output[$position] = $item; } ksort($output); var_dump($output);

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.0090.00916.50
8.3.50.0080.01021.94
8.3.40.0030.01218.60
8.3.30.0080.00619.10
8.3.20.0030.00520.16
8.3.10.0080.00023.65
8.3.00.0090.00019.13
8.2.180.0160.00318.29
8.2.170.0130.00622.96
8.2.160.0030.01220.39
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00926.16
8.2.120.0050.00222.27
8.2.110.0000.00922.30
8.2.100.0090.00317.84
8.2.90.0040.00419.01
8.2.80.0040.00417.97
8.2.70.0080.00017.50
8.2.60.0000.00817.93
8.2.50.0080.00018.07
8.2.40.0000.00818.28
8.2.30.0040.00418.09
8.2.20.0040.00417.75
8.2.10.0000.00718.06
8.2.00.0000.01117.74
8.1.280.0120.00925.92
8.1.270.0030.00622.06
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0090.00023.98
8.1.230.0040.00719.13
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0030.00717.47
8.1.190.0040.00417.54
8.1.180.0050.00318.10
8.1.170.0000.00818.64
8.1.160.0000.00821.89
8.1.150.0000.00818.57
8.1.140.0000.00717.32
8.1.130.0000.00717.77
8.1.120.0000.00717.51
8.1.110.0040.00417.50
8.1.100.0050.00317.32
8.1.90.0000.00717.39
8.1.80.0070.00017.34
8.1.70.0030.00317.39
8.1.60.0120.00017.58
8.1.50.0040.00417.43
8.1.40.0020.00517.54
8.1.30.0050.00317.62
8.1.20.0060.00317.66
8.1.10.0000.00817.58
8.1.00.0040.00417.40
8.0.300.0000.00718.77
8.0.290.0000.00717.18
8.0.280.0070.00018.44
8.0.270.0030.00317.27
8.0.260.0060.00017.26
8.0.250.0070.00016.87
8.0.240.0030.00316.85
8.0.230.0070.00016.86
8.0.220.0070.00016.93
8.0.210.0000.00716.78
8.0.200.0000.00616.91
8.0.190.0070.00017.02
8.0.180.0040.00416.86
8.0.170.0040.00416.93
8.0.160.0070.00016.88
8.0.150.0090.00016.70
8.0.140.0040.00416.73
8.0.130.0060.00013.31
8.0.120.0040.00416.87
8.0.110.0060.00316.82
8.0.100.0000.00716.84
8.0.90.0050.00316.79
8.0.80.0100.01016.81
8.0.70.0080.00016.76
8.0.60.0040.00416.89
8.0.50.0040.00416.79
8.0.30.0070.01117.23
8.0.20.0150.00817.40
8.0.10.0040.00417.07
8.0.00.0170.00316.94
7.4.330.0000.00515.00
7.4.320.0040.00416.60
7.4.300.0030.00316.59
7.4.290.0070.00016.65
7.4.280.0030.00316.58
7.4.270.0040.00416.43
7.4.260.0030.00316.58
7.4.250.0050.00316.61
7.4.240.0040.00416.54
7.4.230.0070.00016.64
7.4.220.0100.00716.64
7.4.210.0050.01216.53
7.4.200.0040.00416.42
7.4.190.0030.00316.41
7.4.160.0080.00816.54
7.4.150.0070.01117.40
7.4.140.0190.00617.86
7.4.130.0130.00416.57
7.4.120.0150.00216.58
7.4.110.0100.01016.66
7.4.100.0150.00316.55
7.4.90.0110.00616.51
7.4.80.0040.01219.39
7.4.70.0100.00616.44
7.4.60.0060.00916.38
7.4.50.0030.00516.25
7.4.40.0030.01022.77
7.4.30.0050.01016.48
7.4.00.0070.01015.07
7.3.330.0050.00013.23
7.3.320.0050.00013.21
7.3.310.0000.00716.38
7.3.300.0030.00316.31
7.3.290.0070.01316.28
7.3.280.0080.01216.37
7.3.270.0140.00317.40
7.3.260.0170.00016.55
7.3.250.0070.01316.41
7.3.240.0080.00916.29
7.3.230.0060.00916.54
7.3.210.0080.01116.29
7.3.200.0120.01119.39
7.3.190.0060.01816.50
7.3.180.0150.00616.58
7.3.170.0000.01716.27
7.3.160.0120.00316.44
7.3.120.0070.01015.08
7.2.330.0090.00916.68
7.2.320.0060.01216.73
7.2.310.0120.00416.73
7.2.300.0080.00816.43
7.2.290.0150.00616.47
7.2.60.0060.01016.59
7.2.00.0000.01119.34
7.1.200.0100.00315.63
7.1.100.0100.00317.85
7.1.70.0000.00717.38
7.1.60.0060.01919.46
7.1.50.0100.01317.04
7.1.00.0000.08022.35
7.0.200.0030.00716.55
7.0.140.0030.07322.07
7.0.60.0270.05320.07
7.0.50.0000.04317.66
7.0.40.0130.08019.96
7.0.30.0270.05320.13
7.0.20.0370.07320.30
7.0.10.0070.07320.13
7.0.00.0130.04720.16
5.6.280.0030.07321.11
5.6.210.0070.07720.50
5.6.200.0030.05018.17
5.6.190.0130.07720.41
5.6.180.0200.05020.41
5.6.170.0130.04320.50
5.6.160.0130.07720.61
5.6.150.0030.08718.13
5.6.140.0100.06018.11
5.6.130.0100.06718.21
5.6.120.0070.03721.12
5.6.110.0070.08720.99
5.6.100.0230.08020.98
5.6.90.0170.06320.97
5.6.80.0070.08320.51
5.5.350.0330.07320.45
5.5.340.0070.06017.99
5.5.330.0100.07020.47
5.5.320.0230.05320.29
5.5.310.0200.04320.32
5.5.300.0070.06717.91
5.5.290.0030.08718.02
5.5.280.0100.03320.87
5.5.270.0070.06320.84
5.5.260.0030.04020.64
5.5.250.0070.06320.68
5.5.240.0130.09020.32
5.4.450.3700.03719.38
5.4.440.0070.03719.41
5.4.430.1230.04019.38
5.4.420.3030.03719.29
5.4.410.3070.04319.43
5.4.400.3800.04319.15
5.4.390.3870.04019.18
5.4.380.3300.04019.08
5.4.370.3770.04018.88
5.4.360.3630.03719.16
5.4.350.3870.03019.05
5.4.340.3630.04019.06
5.4.320.4130.03719.14
5.4.310.3830.04018.87
5.4.300.4630.04019.14
5.4.290.4400.03019.05
5.4.280.3900.03318.88
5.4.270.4130.04018.87
5.4.260.4270.04319.15
5.4.250.3830.04018.99
5.4.240.3630.02719.21
5.4.230.3630.03719.17
5.4.220.3670.04018.98
5.4.210.3930.03319.06
5.4.200.3900.04318.86
5.4.190.4230.04019.14
5.4.180.4430.03318.86
5.4.170.0000.06019.03
5.4.160.3670.03718.97
5.4.150.3730.04019.18
5.4.140.4830.04016.39
5.4.130.4630.03316.43
5.4.120.5830.03016.31
5.4.110.4300.03316.16
5.4.100.4630.03716.35
5.4.90.4200.03016.35
5.4.80.3970.03016.45
5.4.70.0030.05316.24
5.4.60.0030.06716.29
5.4.50.4070.03716.30
5.4.40.5600.04016.46
5.4.30.4330.03316.29
5.4.20.4470.03716.46
5.4.10.4170.03716.35
5.4.00.3670.03315.84
5.3.290.4000.04714.75
5.3.280.3870.03714.38
5.3.270.0030.07314.55
5.3.260.4130.04014.58
5.3.250.4270.03314.70
5.3.240.3770.03014.62
5.3.230.4470.03714.57
5.3.220.4430.03014.46
5.3.210.4570.03714.49
5.3.200.4570.03314.50
5.3.190.3900.04014.46
5.3.180.3630.03014.50
5.3.170.0000.08014.46
5.3.160.2370.04714.54
5.3.150.4470.03014.35
5.3.140.4530.02314.53
5.3.130.4600.03714.42
5.3.120.4030.03314.33
5.3.110.4230.04014.48
5.3.100.3730.03714.13
5.3.90.4500.03313.99
5.3.80.4570.03313.86
5.3.70.3970.04014.00
5.3.60.4130.03013.93
5.3.50.3600.03713.91
5.3.40.3900.03313.77
5.3.30.3500.03713.83
5.3.20.3900.03313.62
5.3.10.4830.03713.67
5.3.00.1870.03713.47
5.2.170.3170.03011.12
5.2.160.3370.03311.13
5.2.150.3430.02011.05
5.2.140.4030.02711.13
5.2.130.3030.02311.07
5.2.120.3500.02311.09
5.2.110.1630.02711.04
5.2.100.2200.03011.11
5.2.90.2130.02711.00
5.2.80.2300.03010.97
5.2.70.3000.02711.06
5.2.60.2870.03011.02
5.2.50.2700.03010.99
5.2.40.2400.03010.92
5.2.30.2300.03010.93
5.2.20.0830.03310.90
5.2.10.1970.03010.82
5.2.00.1870.02710.79
5.1.60.1830.0239.99
5.1.50.2500.02010.01
5.1.40.2430.0209.97
5.1.30.2500.02310.23
5.1.20.2130.02710.38
5.1.10.1400.02010.07
5.1.00.2030.0239.97
5.0.50.1200.0208.39
5.0.40.1170.0208.39
5.0.30.1330.0308.27
5.0.20.1470.0178.10
5.0.10.1170.0208.19
5.0.00.1530.0238.13
4.4.90.1030.0176.23
4.4.80.1000.0106.23
4.4.70.0300.0176.23
4.4.60.0600.0176.23
4.4.50.0800.0206.23
4.4.40.1170.0206.23
4.4.30.1170.0176.23
4.4.20.1230.0136.23
4.4.10.1330.0176.23
4.4.00.1230.0206.23
4.3.110.1400.0136.23
4.3.100.1430.0206.23
4.3.90.1430.0136.23
4.3.80.1300.0236.23
4.3.70.1370.0176.23
4.3.60.1470.0176.23
4.3.50.1170.0176.23
4.3.40.1200.0236.23
4.3.30.0770.0276.23
4.3.20.0800.0236.23
4.3.10.0800.0276.23
4.3.00.0800.0176.23

preferences:
42.22 ms | 401 KiB | 5 Q