3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array('a' => 2, 'b' => 1, 'c' => 4); $first = array(key($array) => current($array)); // Get the first key/value pair //array_shift($array); // Remove it from your array $last = array_flip(array(end($array) => key($array))); // Get the last key/value pair //array_pop($array); // Remove it from the array $array = array_merge($last, array_slice($array,1,count($array) - 2), $first); // Put it back together print_r($array);

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.40.0160.00018.73
8.3.30.0100.00320.17
8.3.20.0040.00418.73
8.3.10.0050.00320.98
8.3.00.0040.00422.37
8.2.170.0040.01122.96
8.2.160.0140.00020.35
8.2.150.0060.00324.18
8.2.140.0080.00424.66
8.2.130.0030.00526.16
8.2.120.0040.00420.74
8.2.110.0120.00619.24
8.2.100.0120.00017.82
8.2.90.0050.00319.17
8.2.80.0000.00818.04
8.2.70.0090.00017.63
8.2.60.0050.00317.93
8.2.50.0000.00818.07
8.2.40.0000.00818.18
8.2.30.0070.00019.43
8.2.20.0030.00617.77
8.2.10.0000.00817.74
8.2.00.0020.00517.80
8.1.270.0080.00023.99
8.1.260.0100.00326.35
8.1.250.0070.00028.09
8.1.240.0060.00322.58
8.1.230.0040.00821.04
8.1.220.0060.00318.77
8.1.210.0030.00619.16
8.1.200.0100.00017.35
8.1.190.0070.00017.40
8.1.180.0080.00318.10
8.1.170.0000.00718.56
8.1.160.0070.00018.79
8.1.150.0000.00818.48
8.1.140.0030.00617.51
8.1.130.0030.00317.76
8.1.120.0030.00517.44
8.1.110.0060.00317.52
8.1.100.0040.00417.36
8.1.90.0050.00317.46
8.1.80.0030.00517.48
8.1.70.0000.00717.38
8.1.60.0000.00917.54
8.1.50.0040.00417.51
8.1.40.0000.00717.50
8.1.30.0000.00717.55
8.1.20.0080.00017.55
8.1.10.0080.00017.48
8.1.00.0030.00617.51
8.0.300.0040.00419.97
8.0.290.0000.00717.05
8.0.280.0030.00318.43
8.0.270.0000.00717.04
8.0.260.0000.00616.67
8.0.250.0050.00216.91
8.0.240.0040.00416.80
8.0.230.0030.00416.77
8.0.220.0000.00716.87
8.0.210.0030.00316.76
8.0.200.0060.00316.89
8.0.190.0030.00516.84
8.0.180.0100.00016.87
8.0.170.0050.00316.88
8.0.160.0030.00316.82
8.0.150.0050.00216.89
8.0.140.0000.00716.81
8.0.130.0060.00013.38
8.0.120.0030.00516.83
8.0.110.0040.00416.88
8.0.100.0040.00416.86
8.0.90.0000.00816.72
8.0.80.0030.01816.77
8.0.70.0040.00416.95
8.0.60.0000.00816.88
8.0.50.0080.00016.68
8.0.30.0110.00817.06
8.0.20.0130.00517.40
8.0.10.0030.00517.03
8.0.00.0070.01216.69
7.4.330.0050.00016.77
7.4.320.0060.00016.61
7.4.300.0000.00616.59
7.4.290.0070.00016.65
7.4.280.0030.00316.57
7.4.270.0000.00616.43
7.4.260.0040.00416.50
7.4.250.0000.00816.61
7.4.240.0000.00716.46
7.4.230.0040.00416.57
7.4.220.0070.01116.59
7.4.210.0100.00716.64
7.4.200.0030.00316.62
7.4.190.0080.00016.67
7.4.160.0080.00816.40
7.4.150.0120.00617.40
7.4.140.0070.01417.86
7.4.130.0100.00716.40
7.4.120.0150.00216.44
7.4.110.0030.02116.39
7.4.100.0120.00616.63
7.4.90.0070.01016.61
7.4.80.0070.01019.39
7.4.70.0120.00916.22
7.4.60.0090.00616.46
7.4.50.0030.00616.18
7.4.40.0070.01022.77
7.4.30.0140.00316.43
7.4.10.0120.00614.92
7.4.00.0030.01114.94
7.3.330.0000.00513.02
7.3.320.0050.00012.98
7.3.310.0030.00316.24
7.3.300.0060.00016.29
7.3.290.0080.00516.20
7.3.280.0080.01016.25
7.3.270.0090.01317.40
7.3.260.0090.01018.24
7.3.250.0070.01016.42
7.3.240.0080.00816.61
7.3.230.0130.00316.39
7.3.210.0100.00716.66
7.3.200.0160.00619.39
7.3.190.0050.00816.47
7.3.180.0060.00916.30
7.3.170.0140.00716.37
7.3.160.0090.00816.38
7.3.130.0070.01114.74
7.3.120.0100.00514.93
7.3.110.0030.01314.86
7.3.100.0000.01414.87
7.3.90.0060.01014.53
7.3.80.0060.00614.68
7.3.70.0080.00014.77
7.3.60.0050.00814.60
7.3.50.0040.00414.79
7.3.40.0040.01114.82
7.3.30.0050.00514.89
7.3.20.0030.00716.62
7.3.10.0060.00516.65
7.3.00.0080.00616.46
7.2.330.0100.01416.36
7.2.320.0060.01116.65
7.2.310.0030.01616.82
7.2.300.0060.01016.47
7.2.290.0060.00916.45
7.2.260.0090.00915.18
7.2.250.0000.01715.16
7.2.240.0070.00715.09
7.2.230.0030.01014.52
7.2.220.0130.00314.99
7.2.210.0040.01115.03
7.2.200.0030.00615.19
7.2.190.0030.01015.14
7.2.180.0070.00314.88
7.2.170.0060.00915.11
7.2.160.0070.00715.20
7.2.150.0000.01516.68
7.2.140.0000.01416.70
7.2.130.0030.01016.81
7.2.120.0000.01016.90
7.2.110.0090.00416.80
7.2.100.0050.00816.80
7.2.90.0060.00816.65
7.2.80.0050.00716.88
7.2.70.0030.01216.94
7.2.60.0090.00516.88
7.2.50.0030.00916.92
7.2.40.0080.00616.89
7.2.30.0090.01116.70
7.2.20.0060.00816.91
7.2.10.0100.00417.08
7.2.00.0080.00817.57
7.1.330.0060.00615.73
7.1.320.0000.01015.65
7.1.310.0030.00615.65
7.1.300.0030.00615.61
7.1.290.0030.00715.90
7.1.280.0040.01115.68
7.1.270.0080.00015.58
7.1.260.0060.00315.56
7.1.250.0050.01015.79
7.1.240.0050.00815.81
7.1.230.0080.00515.83
7.1.220.0050.01015.67
7.1.210.0060.00715.59
7.1.200.0100.00315.70
7.1.190.0030.01015.56
7.1.180.0090.00515.67
7.1.170.0040.00715.88
7.1.160.0080.01015.76
7.1.150.0050.00815.77
7.1.140.0070.00815.94
7.1.130.0070.00315.66
7.1.120.0060.00615.69
7.1.110.0020.01215.74
7.1.100.0070.00915.87
7.1.90.0030.00815.69
7.1.80.0020.00615.74
7.1.70.0060.00716.12
7.1.60.0060.00716.83
7.1.50.0080.00816.21
7.1.40.0020.01015.60
7.1.30.0080.00615.57
7.1.20.0030.00815.50
7.1.10.0020.01215.71
7.1.00.0030.03017.90
7.0.330.0060.00415.15
7.0.320.0030.00815.26
7.0.310.0070.00515.11
7.0.300.0100.00315.14
7.0.290.0070.00415.24
7.0.280.0060.00415.20
7.0.270.0040.00715.27
7.0.260.0050.01015.20
7.0.250.0040.00915.47
7.0.240.0030.01115.22
7.0.230.0030.01015.13
7.0.220.0040.00815.37
7.0.210.0060.01015.14
7.0.200.0050.00715.87
7.0.190.0040.01215.25
7.0.180.0050.00815.24
7.0.170.0060.00615.19
7.0.160.0070.00515.35
7.0.150.0050.00615.46
7.0.140.0090.02317.65
7.0.130.0030.00815.38
7.0.120.0080.00315.26
7.0.110.0060.00515.49
7.0.100.0070.00415.37
7.0.90.0030.01015.31
7.0.80.0020.01415.26
7.0.70.0050.01015.38
7.0.60.0030.03216.90
7.0.50.0070.02916.20
7.0.40.0040.02015.89
7.0.30.0120.02215.78
7.0.20.0100.03015.79
7.0.10.0120.02015.83
7.0.00.0020.02515.77
5.6.400.0090.00614.19
5.6.390.0000.00814.13
5.6.380.0060.00314.26
5.6.370.0050.00814.25
5.6.360.0080.00614.54
5.6.350.0040.00714.32
5.6.340.0030.00914.08
5.6.330.0050.00714.33
5.6.320.0040.00614.34
5.6.310.0080.00814.19
5.6.300.0060.00514.25
5.6.290.0070.00714.30
5.6.280.0040.02916.56
5.6.270.0050.00714.36
5.6.260.0110.00514.30
5.6.250.0000.01514.29
5.6.240.0080.00414.27
5.6.230.0050.00914.21
5.6.220.0080.00614.39
5.6.210.0100.02716.43
5.6.200.0060.03415.56
5.6.190.0050.03516.49
5.6.180.0130.01716.37
5.6.170.0140.02216.22
5.6.160.0070.03016.40
5.6.150.0060.02015.47
5.6.140.0040.02015.46
5.6.130.0050.03115.62
5.6.120.0110.02816.51
5.6.110.0040.02816.37
5.6.100.0060.02816.53
5.6.90.0070.03116.45
5.6.80.0090.02716.27
5.6.70.0030.01214.04
5.6.60.0030.00814.12
5.6.50.0030.00914.17
5.6.40.0050.00814.36
5.6.30.0080.00514.31
5.6.20.0050.01213.99
5.6.10.0050.00714.01
5.6.00.0050.00714.18
5.5.380.0050.00712.84
5.5.370.0090.00612.65
5.5.360.0050.00512.63
5.5.350.0100.03115.30
5.5.340.0030.03014.45
5.5.330.0010.03315.24
5.5.320.0140.01915.23
5.5.310.0150.01515.20
5.5.300.0070.03114.35
5.5.290.0060.02814.42
5.5.280.0040.03115.34
5.5.270.0030.03115.27
5.5.260.0080.02015.39
5.5.250.0110.02715.20
5.5.240.0070.03015.16
5.5.230.0030.00712.63
5.5.220.0000.01012.63
5.5.210.0040.00312.61
5.5.200.0070.00612.61
5.5.190.0020.00912.71
5.5.180.0070.00312.50
5.5.170.0050.00712.56
5.5.160.0020.01012.64
5.5.150.0040.00612.63
5.5.140.0030.00912.61
5.5.130.0080.00512.70
5.5.120.0030.00612.53
5.5.110.0050.00612.46
5.5.100.0010.00812.51
5.5.90.0070.00612.57
5.5.80.0060.00612.64
5.5.70.0060.00612.59
5.5.60.0050.00512.57
5.5.50.0020.01112.49
5.5.40.0050.00712.45
5.5.30.0080.00112.53
5.5.20.0050.00312.60
5.5.10.0020.01012.42
5.5.00.0020.00812.48
5.4.450.0050.02114.67
5.4.440.0070.01914.81
5.4.430.0360.02414.68
5.4.420.0580.01514.82
5.4.410.0040.02214.70
5.4.400.0040.02814.64
5.4.390.0410.01714.67
5.4.380.0500.01914.70
5.4.370.0050.01714.54
5.4.360.0070.01914.64
5.4.350.0490.01514.65
5.4.340.0060.03014.60
5.4.330.0060.00612.42
5.4.320.0030.02514.59
5.4.310.0060.01314.54
5.4.300.0600.01414.64
5.4.290.0690.01514.54
5.4.280.0670.01414.67
5.4.270.0050.02214.70
5.4.260.0030.02314.64
5.4.250.0380.01514.64
5.4.240.0060.01814.57
5.4.230.0030.01514.64
5.4.220.0050.02114.63
5.4.210.0180.01514.64
5.4.200.0060.01514.64
5.4.190.0020.02014.64
5.4.180.0030.01614.58
5.4.170.0030.01614.68
5.4.160.0420.01814.63
5.4.150.0760.02014.64
5.4.140.0060.01813.79
5.4.130.0070.01513.72
5.4.120.0080.01613.74
5.4.110.0080.01713.75
5.4.100.0080.01613.80
5.4.90.0080.01613.69
5.4.80.0030.01513.74
5.4.70.0060.01713.76
5.4.60.0010.01613.77
5.4.50.0050.01713.80
5.4.40.0080.01513.77
5.4.30.0070.01513.73
5.4.20.0120.01813.71
5.4.10.0120.01413.68
5.4.00.0090.01613.58
5.3.290.0110.01713.13
5.3.280.0080.01513.13
5.3.270.0070.01613.13
5.3.260.0080.01713.13
5.3.250.0100.01313.16
5.3.240.0110.01613.10
5.3.230.0070.01713.10
5.3.220.0120.01213.08
5.3.210.0030.01713.08
5.3.200.0040.01813.12
5.3.190.0060.01813.08
5.3.180.0100.01813.08
5.3.170.0070.02013.12
5.3.160.0100.01713.15
5.3.150.0090.01313.08
5.3.140.0100.02313.08
5.3.130.0050.02013.11
5.3.120.0080.01613.16
5.3.110.0110.01713.11
5.3.100.0070.01612.94
5.3.90.0110.01412.90
5.3.80.0110.01412.89
5.3.70.0090.01512.90
5.3.60.0070.02112.90
5.3.50.0090.01512.96
5.3.40.0050.01612.96
5.3.30.0040.01612.86
5.3.20.0030.01312.79
5.3.10.0020.01512.84
5.3.00.0060.01212.81
5.2.170.0050.01311.54
5.2.160.0320.01311.54
5.2.150.0250.01211.54
5.2.140.0040.01611.54
5.2.130.0020.02511.54
5.2.120.0120.01511.54
5.2.110.0670.02011.54
5.2.100.0060.01511.54
5.2.90.0050.01711.54
5.2.80.0020.02311.54
5.2.70.0400.01811.54
5.2.60.0070.01311.54
5.2.50.0000.01911.54
5.2.40.0410.02111.54
5.2.30.0050.01811.54
5.2.20.0040.01611.54
5.2.10.0030.01711.54
5.2.00.0120.01311.54
5.1.60.0100.01311.54
5.1.50.0040.01611.54
5.1.40.0050.01611.54
5.1.30.0100.01311.54
5.1.20.0050.01511.54
5.1.10.0070.01511.54
5.1.00.0060.01411.54
5.0.50.0030.01211.54
5.0.40.0000.01211.54
5.0.30.0020.01811.54
5.0.20.0020.01411.54
5.0.10.0050.01111.54
5.0.00.0040.02311.54
4.4.90.0030.00811.54
4.4.80.0020.01111.54
4.4.70.0020.01111.54
4.4.60.0020.01411.54
4.4.50.0020.01211.54
4.4.40.0050.01311.54
4.4.30.0000.01011.54
4.4.20.0030.01011.54
4.4.10.0020.01011.54
4.4.00.0050.01211.54
4.3.110.0070.00711.54
4.3.100.0060.00811.54
4.3.90.0050.00811.54
4.3.80.0030.01511.54
4.3.70.0050.00811.54
4.3.60.0050.01511.54
4.3.50.0020.01411.54
4.3.40.0030.01711.54
4.3.30.0040.00811.54
4.3.20.0030.01311.54
4.3.10.0030.01011.54
4.3.00.0050.00811.54

preferences:
36.05 ms | 400 KiB | 5 Q