3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth']; shuffle($data); $result = []; $item = array_shift($data); for($i=0; $i<count($data); $i++) { $result[] = [$item, $item=$data[$i]]; } $result[] = [$result[count($result-1)][1], $result[0][0]]; var_dump($result);

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)
7.4.10.0100.00316.54
7.4.00.0100.01016.68
7.3.130.0130.00616.40
7.3.120.0090.00916.42
7.3.110.0070.00716.43
7.3.100.0100.00316.45
7.3.90.0110.00416.34
7.3.80.0090.00316.48
7.3.70.0030.01216.34
7.3.60.0120.00616.54
7.3.50.0040.01116.37
7.3.40.0030.00616.29
7.3.30.0080.00416.46
7.3.20.0060.00918.14
7.3.10.0030.00918.21
7.3.00.0040.00718.16
7.2.260.0100.01016.79
7.2.250.0100.01016.73
7.2.240.0110.00416.59
7.2.230.0060.00616.46
7.2.220.0060.00916.68
7.2.210.0030.00916.63
7.2.200.0040.01416.47
7.2.190.0100.01016.50
7.2.180.0040.01116.56
7.2.170.0100.00316.50
7.2.160.0030.01216.45
7.2.150.0000.01718.47
7.2.140.0070.00718.38
7.2.130.0000.01218.32
7.2.120.0000.01118.29
7.2.110.0000.01618.44
7.2.100.0040.01518.39
7.2.90.0030.00918.43
7.2.80.0060.00618.45
7.2.70.0140.00018.37
7.2.60.0070.00718.52
7.2.50.0070.01018.37
7.2.40.0070.01018.43
7.2.30.0000.01318.36
7.2.20.0000.01018.38
7.2.10.0060.00918.20
7.2.00.0040.00918.76
7.1.330.0070.01117.34
7.1.320.0090.00617.50
7.1.310.0090.00017.34
7.1.300.0040.01517.12
7.1.290.0040.00817.23
7.1.280.0000.00917.32
7.1.270.0030.01017.24
7.1.260.0060.01017.21
7.1.250.0070.00617.33
7.1.240.0060.00617.27
7.1.230.0000.01417.37
7.1.220.0070.00717.19
7.1.210.0060.00317.43
7.1.200.0070.00717.33
7.1.190.0070.01017.44
7.1.180.0030.01017.32
7.1.170.0000.01517.23
7.1.160.0040.01117.34
7.1.150.0000.00917.38
7.1.140.0030.01017.31
7.1.130.0070.01017.25
7.1.120.0040.00817.07
7.1.110.0070.00717.42
7.1.100.0030.00617.25
7.1.90.0000.00817.29
7.1.80.0060.00617.24
7.1.70.0050.01017.26
7.1.60.0080.00918.52
7.1.50.0050.01217.20
7.1.40.0060.00617.50
7.1.30.0060.00317.40
7.1.20.0120.00017.35
7.1.10.0040.01117.08
7.1.00.0080.04119.94
7.0.330.0000.01417.04
7.0.320.0060.00617.06
7.0.310.0100.00316.91
7.0.300.0000.01517.17
7.0.290.0040.00816.91
7.0.280.0060.00316.92
7.0.270.0080.00316.90
7.0.260.0040.00816.94
7.0.250.0000.01017.02
7.0.240.0030.00617.08
7.0.230.0040.00716.98
7.0.220.0070.00317.10
7.0.210.0030.01616.81
7.0.200.0030.00717.00
7.0.190.0030.00916.93
7.0.180.0090.00317.16
7.0.170.0080.00817.07
7.0.160.0080.00417.25
7.0.150.0030.01317.08
7.0.140.0020.04119.57
7.0.130.0030.00617.05
7.0.120.0070.01017.05
7.0.110.0030.02118.40
7.0.100.0210.04518.42
7.0.90.0240.02718.55
7.0.80.0300.02018.57
7.0.70.0150.02718.35
7.0.60.0260.03618.54
7.0.50.0250.02018.46
7.0.40.0070.02217.32
7.0.30.0060.03517.42
7.0.20.0030.02717.29
7.0.10.0090.03417.35
7.0.00.0050.04117.35
5.6.400.0030.01016.14
5.6.390.0030.01015.74
5.6.380.0060.01016.07
5.6.370.0070.01015.86
5.6.360.0070.01016.06
5.6.350.0070.00715.96
5.6.340.0000.01216.21
5.6.330.0140.00015.95
5.6.320.0030.00616.07
5.6.310.0040.00716.04
5.6.300.0100.00716.23
5.6.290.0030.00615.76
5.6.280.0050.04018.55
5.6.270.0030.00616.10
5.6.260.0050.02718.15
5.6.250.0070.02518.35
5.6.240.0050.02718.30
5.6.230.0070.02018.24
5.6.220.0050.02318.30
5.6.210.0070.02218.15
5.6.200.0050.03618.23
5.6.190.0050.04718.24
5.6.180.0030.02318.30
5.6.170.0050.03418.24
5.6.160.0020.02618.23
5.6.150.0060.02318.42
5.6.140.0070.02018.20
5.6.130.0030.02418.30
5.6.120.0090.04218.18
5.6.110.0120.02218.31
5.6.100.0050.02818.18
5.6.90.0030.02118.34
5.6.80.0070.02317.95
5.6.70.0050.02317.89
5.6.60.0100.01717.85
5.6.50.0040.02517.94
5.6.40.0070.01817.86
5.6.30.0000.02517.98
5.6.20.0030.02217.95
5.6.10.0050.02617.86
5.6.00.0040.02017.84
5.5.380.0030.04316.73
5.5.370.0060.02016.60
5.5.360.0070.03816.70
5.5.350.0080.02716.80
5.5.340.0150.03817.04
5.5.330.0080.02516.93
5.5.320.0030.02617.09
5.5.310.0040.02517.08
5.5.300.0060.02016.99
5.5.290.0050.03916.91
5.5.280.0090.04016.68
5.5.270.0030.03016.92
5.5.260.0070.02516.87
5.5.250.0100.03516.85
5.5.240.0030.02616.72
5.5.230.0030.04016.58
5.5.220.0080.02716.68
5.5.210.0080.02316.67
5.5.200.0060.01816.50
5.5.190.0030.02116.46
5.5.180.0080.02216.42
5.5.170.0030.01615.62
5.5.160.0040.02616.50
5.5.150.0070.02316.53
5.5.140.0070.02016.54
5.5.130.0030.02416.57
5.5.120.0000.02516.70
5.5.110.0020.02516.60
5.5.100.0060.02616.42
5.5.90.0060.03516.54
5.5.80.0070.02016.55
5.5.70.0040.02316.46
5.5.60.0030.02316.62
5.5.50.0070.02016.62
5.5.40.0030.02516.46
5.5.30.0050.02516.57
5.5.20.0030.02416.57
5.5.10.0100.01716.44
5.5.00.0110.01716.37
5.4.450.0000.03216.43
5.4.440.0030.02716.49
5.4.430.0050.02316.49
5.4.420.0050.02016.47
5.4.410.0020.02516.50
5.4.400.0000.02616.29
5.4.390.0030.02316.27
5.4.380.0020.02616.31
5.4.370.0070.02416.41
5.4.360.0120.02216.41
5.4.350.0030.01916.25
5.4.340.0050.02016.28
5.4.330.0060.00313.54
5.4.320.0040.01716.33
5.4.310.0030.02516.25
5.4.300.0040.02216.33
5.4.290.0050.02516.35
5.4.280.0000.02316.23
5.4.270.0070.02016.24
5.4.260.0040.02116.40
5.4.250.0020.02016.36
5.4.240.0060.02516.33
5.4.230.0050.01816.36
5.4.220.0050.02516.40
5.4.210.0020.02316.26
5.4.200.0050.02416.26
5.4.190.0050.01816.24
5.4.180.0070.02016.27
5.4.170.0030.02716.39
5.4.160.0030.02116.23
5.4.150.0040.02016.30
5.4.140.0040.01915.02
5.4.130.0030.02014.87
5.4.120.0050.02214.90
5.4.110.0040.01814.91
5.4.100.0030.03014.96
5.4.90.0020.02214.96
5.4.80.0010.02715.02
5.4.70.0050.03214.83
5.4.60.0050.01914.94
5.4.50.0050.01814.96
5.4.40.0060.01715.05
5.4.30.0050.01815.01
5.4.20.0020.02215.00
5.4.10.0050.02614.94
5.4.00.0060.01714.73
5.3.290.0030.02114.06
5.3.280.0020.02214.02
5.3.270.0060.02314.07
5.3.260.0030.02414.05
5.3.250.0050.01814.01
5.3.240.0030.01714.03
5.3.230.0030.02113.96
5.3.220.0050.02014.10
5.3.210.0030.02213.98
5.3.200.0020.02213.99
5.3.190.0050.01814.11
5.3.180.0090.01714.05
5.3.170.0050.02514.05
5.3.160.0020.02113.99
5.3.150.0060.02314.09
5.3.140.0050.02014.10
5.3.130.0030.03514.10
5.3.120.0070.01714.06
5.3.110.0020.02614.01
5.3.100.0030.02113.82
5.3.90.0100.01213.79
5.3.80.0020.02513.79
5.3.70.0050.02013.83
5.3.60.0030.02313.69
5.3.50.0020.02313.69
5.3.40.0080.01613.71
5.3.30.0030.01813.69
5.3.20.0060.01813.66
5.3.10.0030.02313.54
5.3.00.0030.02213.60
5.2.170.0100.03311.96
5.2.160.0000.03011.96
5.2.150.0070.02711.96
5.2.140.0030.02311.96
5.2.130.0070.05311.96
5.2.120.0000.03711.96
5.2.110.0030.02311.96
5.2.100.0000.03011.96
5.2.90.0030.03311.96
5.2.80.0070.02311.96
5.2.70.0000.02711.96
5.2.60.0000.02711.96
5.2.50.0000.02711.96
5.2.40.0000.02711.96
5.2.30.0000.03011.96
5.2.20.0070.02711.96
5.2.10.0030.02311.96
5.2.00.0070.02011.96
5.1.60.0070.04011.96
5.1.50.0000.05011.96
5.1.40.0030.02011.96
5.1.30.0070.02011.96
5.1.20.0030.02011.96
5.1.10.0170.01311.96
5.1.00.0070.02011.96
5.0.50.0030.02011.96
5.0.40.0000.01711.96
5.0.30.0000.02711.96
5.0.20.0030.01311.96
5.0.10.0030.01311.96
5.0.00.0030.02311.96
4.4.90.0000.01711.96
4.4.80.0000.01711.96
4.4.70.0000.02311.96
4.4.60.0030.02011.96
4.4.50.0000.01711.96
4.4.40.0000.02311.96
4.4.30.0030.01311.96
4.4.20.0000.02711.96
4.4.10.0000.01711.96
4.4.00.0000.02311.96
4.3.110.0030.01711.96
4.3.100.0030.01011.96
4.3.90.0030.01711.96
4.3.80.0000.02011.96
4.3.70.0000.01311.96
4.3.60.0030.01011.96
4.3.50.0000.01311.96
4.3.40.0000.02711.96
4.3.30.0000.01311.96
4.3.20.0030.01011.96
4.3.10.0000.01311.96
4.3.00.0000.01311.96

preferences:
37.89 ms | 401 KiB | 5 Q