3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'); $start = microtime(true); for($k=0;$k<100;$k++) { $str = ltrim(strrev(chunk_split(implode(array_reverse($vars)), 3, ';')),';'); } $end = microtime(true); echo $end - $start; echo "\n\n"; $start = microtime(true); for($k=0;$k<100;$k++) { $size = sizeOf($vars); for ($i = $size-3; $i > 0; $i-=3) { array_splice($vars,$i,0,";"); } } $end = microtime(true); echo $end - $start; echo "\n\n"; $start = microtime(true); for($k=0;$k<100;$k++) { $array = array_reverse(range('a', 'h')); // reverse $array = array_chunk($array, 3); // cut by threes $string = ''; foreach ($array as $value) { $string .= implode($value); // glue them if(count($value) == 3) { // if still three, add a semi $string .= ';'; } } $string = strrev($string); // then reverse them again } $end = microtime(true); echo $end - $start;

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.2.00.0102.49121.48
7.1.70.0032.49819.13
7.1.60.5531.94921.08
7.1.50.5071.99421.27
7.1.00.0002.50024.34
7.0.200.0772.42418.77
7.0.140.0072.49323.98
7.0.60.0032.47722.28
7.0.50.0102.49019.96
7.0.40.0102.49019.66
7.0.30.0302.47019.91
7.0.20.0202.48019.75
7.0.10.0132.48719.74
7.0.00.0132.48719.78
5.6.280.0032.49724.34
5.6.210.0072.49323.80
5.6.200.0072.49321.04
5.6.190.0032.49723.36
5.6.180.0432.45723.14
5.6.170.0432.45723.38
5.6.160.0132.48723.26
5.6.150.0002.50021.24
5.6.140.0072.49321.23
5.6.130.0232.47721.09
5.6.120.0072.49323.95
5.6.110.0072.49323.94
5.6.100.0132.48723.84
5.6.90.0072.49324.07
5.6.80.0102.49023.35
5.5.350.0232.47722.91
5.5.340.0032.49720.38
5.5.330.0202.48022.58
5.5.320.0402.46022.55
5.5.310.0172.48322.58
5.5.300.0032.49720.21
5.5.290.0132.48720.34
5.5.280.0172.48323.37
5.5.270.0002.50023.21
5.5.260.0132.48722.80
5.5.250.0132.48723.10
5.5.240.0102.49022.08
5.4.450.0772.40021.68
5.4.440.0232.44021.35
5.4.430.0932.12321.13
5.4.420.1002.35721.04
5.4.410.0272.45721.20
5.4.400.0772.32020.81
5.4.390.1272.34320.67
5.4.380.0302.05720.13
5.4.370.0372.45720.50
5.4.360.0232.47320.55
5.4.350.0402.39320.44
5.4.340.0532.41020.45
5.4.320.0111.99014.50
5.4.310.0131.98914.49
5.4.300.0131.99114.50
5.4.290.0111.99414.49
5.4.280.0201.98614.39
5.4.270.0151.98814.39
5.4.260.0081.99314.39
5.4.250.0151.98614.39
5.4.240.0151.98814.39
5.4.230.0091.99314.39
5.4.220.0171.98514.39
5.4.210.0121.99014.39
5.4.200.0121.98914.38
5.4.190.0101.99014.38
5.4.180.0111.98914.38
5.4.170.0151.98914.39
5.4.160.0121.98914.39
5.4.150.0171.98314.38
5.4.140.0101.99114.07
5.4.130.0151.98614.05
5.4.120.0151.98714.01
5.4.110.0111.99214.01
5.4.100.0121.99114.01
5.4.90.0151.98614.00
5.4.80.0191.98114.00
5.4.70.0191.98214.00
5.4.60.0181.98314.00
5.4.50.0221.98014.00
5.4.40.0071.99314.01
5.4.30.0391.96613.99
5.4.20.0361.97013.99
5.4.10.0171.98413.99
5.4.00.0151.98613.47
5.3.290.0211.98014.92
5.3.280.0231.97814.84
5.3.270.0251.97814.86
5.3.260.1071.89514.84
5.3.250.1151.89214.83
5.3.240.0461.95914.85
5.3.230.0161.98614.82
5.3.220.0241.97814.80
5.3.210.0101.99114.80
5.3.200.0121.98914.82
5.3.190.0141.98714.82
5.3.180.0201.98314.82
5.3.170.0101.99114.83
5.3.160.0251.97514.83
5.3.150.0091.99214.83
5.3.140.0121.98814.80
5.3.130.0141.98914.73
5.3.120.0061.99414.80
5.3.110.0071.99414.78
5.3.100.0101.99414.29
5.3.90.0081.99414.28
5.3.80.0101.99014.27
5.3.70.0081.99414.25
5.3.60.0101.99214.25
5.3.50.0061.99514.20
5.3.40.0091.99114.20
5.3.30.0071.99414.16
5.3.20.0111.99113.95
5.3.10.0061.99513.89
5.3.00.0101.99113.88
5.2.170.0091.99611.30
5.2.160.0091.99211.30
5.2.150.0201.98611.29
5.2.140.0131.99311.29
5.2.130.0032.00011.28
5.2.120.0091.99411.28
5.2.110.0131.98811.25
5.2.100.0121.98811.26
5.2.90.0071.99411.25
5.2.80.0111.99011.27
5.2.70.0081.99211.27
5.2.60.0121.99011.20
5.2.50.0061.99611.17
5.2.40.0081.99411.14
5.2.30.0111.99111.12
5.2.20.0071.99511.09
5.2.10.0111.99211.06
5.2.00.0111.9919.88
5.1.60.0051.99810.30
5.1.50.0101.99410.30
5.1.40.0051.99610.28
5.1.30.0051.99710.63
5.1.20.0091.99210.66
5.1.10.0031.99710.39
5.1.00.0061.99610.38
5.0.50.0051.9958.87
5.0.40.0081.9938.72
5.0.30.0071.9948.52
5.0.20.0081.9958.51
5.0.10.0081.9948.45
5.0.00.0081.9948.49
4.4.90.0041.9956.92
4.4.80.0051.9956.89
4.4.70.0081.9936.87
4.4.60.0111.9916.89
4.4.50.0051.9946.93
4.4.40.0051.9976.88
4.4.30.0041.9966.89
4.4.20.0041.9956.96
4.4.10.0051.9956.98
4.4.00.0061.9956.93
4.3.110.0051.9966.84
4.3.100.0021.9996.82
4.3.90.0031.9996.81
4.3.80.0091.9916.78
4.3.70.0021.9986.83
4.3.60.0071.9956.81
4.3.50.0031.9996.81
4.3.40.0051.9966.77
4.3.30.0071.9915.59
4.3.20.0051.9965.55
4.3.10.0041.9975.49
4.3.00.0172.48016.39

preferences:
37.15 ms | 400 KiB | 5 Q