3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayTester { const TEST_LOOP_SIZE = 100000; public function go() { $start = microtime(true); for($a = 0; $a<=self::TEST_LOOP_SIZE;++$a) { $test = $this->getTest(); $someVal = $test[$a]; } echo 'Pass by copy: ' . (microtime(true) - $start) . ' sec<br>'; $start = microtime(true); for($a = 0; $a<=self::TEST_LOOP_SIZE;++$a) { $test = &$this->getTestByRef(); $someVal = $test[$a]; } echo 'Pass by reference: ' . (microtime(true) - $start) . ' sec<br>'; } private $_test; private function getTest() { if(!$this->_test) { for($a = 0; $a<=self::TEST_LOOP_SIZE;++$a) { $this->_test[$a]=md5($a); } } return $this->_test; } private $_testByRef; private function &getTestByRef() { if(!$this->_testByRef) { for($a = 0; $a<=self::TEST_LOOP_SIZE;++$a) { $this->_testByRef[$a]=md5($a); } } return $this->_testByRef; } } $tester = new ArrayTester(); $tester->go();

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.00.0230.11333.10
7.3.120.0130.12033.05
7.3.110.0230.11432.88
7.3.100.0160.08532.92
7.3.90.0200.08133.04
7.3.80.0200.07332.88
7.3.70.0100.09033.11
7.3.60.0160.08232.88
7.3.50.0100.08633.18
7.3.40.0230.07232.82
7.3.30.0130.09132.85
7.3.20.0200.07536.67
7.3.10.0260.06836.59
7.3.00.0270.07436.58
7.2.250.0230.12533.08
7.2.240.0240.09433.38
7.2.230.0130.08833.22
7.2.220.0160.12233.45
7.2.210.0200.09733.25
7.2.200.0130.10333.38
7.2.190.0130.09033.19
7.2.180.0200.08233.52
7.2.170.0170.08333.36
7.2.00.0610.08838.97
7.1.330.0290.13335.90
7.1.320.0170.12335.77
7.1.310.0200.14335.69
7.1.300.0200.11335.56
7.1.290.0170.11835.61
7.1.280.0170.12735.77
7.1.270.0130.11835.95
7.1.260.0070.13435.84
7.1.70.0070.12637.19
7.1.60.0130.13137.35
7.1.50.0170.12837.20
7.1.00.0000.17742.45
7.0.200.0700.07736.69
7.0.140.0170.15742.15
7.0.60.0170.09738.19
7.0.50.0130.16736.10
7.0.40.0170.10026.61
7.0.30.0330.10726.69
7.0.20.0400.12326.83
7.0.10.0170.16726.75
7.0.00.0030.18326.71
5.6.280.0230.22759.86
5.6.210.0230.22759.66
5.6.200.0170.22057.14
5.6.190.0070.23359.41
5.6.180.3530.15759.39
5.6.170.0370.15359.41
5.6.160.0170.23359.34
5.6.150.0300.21357.14
5.6.140.0200.22357.13
5.6.130.0130.23057.13
5.6.120.0130.16060.02
5.6.110.0230.16760.12
5.6.100.0100.23760.05
5.6.90.0170.18359.99
5.6.80.0070.17759.45
5.6.70.2900.13059.39
5.5.350.0370.19759.48
5.5.340.0130.18357.06
5.5.330.0270.15359.03
5.5.320.0530.18058.98
5.5.310.0430.19759.14
5.5.300.0200.21757.00
5.5.290.0230.23356.93
5.5.280.0130.17359.70
5.5.270.0170.24359.81
5.5.260.0170.18759.75
5.5.250.0030.21059.70
5.5.240.0500.18359.14
5.4.450.0430.22358.27
5.4.440.0570.23358.51
5.4.430.0370.21358.32
5.4.420.0700.21358.51
5.4.410.0370.22758.23
5.4.400.0470.21758.04
5.4.390.0400.22357.80
5.4.380.1100.43357.77
5.4.370.0670.33057.69
5.4.360.0900.36057.73
5.4.350.0430.32757.60
5.4.340.0570.28057.78
5.4.320.0190.17651.51
5.4.310.0190.19151.51
5.4.300.0150.18551.51
5.4.290.0110.18451.51
5.4.280.0200.18351.41
5.4.270.0150.18651.41
5.4.260.0180.18651.41
5.4.250.0210.18251.40
5.4.240.0180.18351.39
5.4.230.0220.18651.40
5.4.220.0130.18151.40
5.4.210.0160.18551.40
5.4.200.0200.18151.39
5.4.190.0230.19451.39
5.4.180.0220.18751.39
5.4.170.0110.22251.41
5.4.160.0270.19851.40
5.4.150.0210.22651.40
5.4.140.0230.20951.08
5.4.130.0240.20651.07
5.4.120.0200.18851.03
5.4.110.0250.19451.03
5.4.100.0190.18451.03
5.4.90.0180.20351.03
5.4.80.0180.19651.03
5.4.70.0150.18651.02
5.4.60.0210.21151.02
5.4.50.0230.18251.02
5.4.40.0230.18851.01
5.4.30.0170.19551.01
5.4.20.0180.19651.00
5.4.10.0160.19051.01
5.4.00.0130.19750.49
5.3.290.0150.23451.19
5.3.280.0190.23351.12
5.3.270.0150.25851.13
5.3.260.0280.25451.12
5.3.250.0150.27551.13
5.3.240.0200.30051.12
5.3.230.0210.32051.11
5.3.220.0200.23951.09
5.3.210.0240.24351.08
5.3.200.0190.23451.08
5.3.190.0240.25251.09
5.3.180.0190.22751.09
5.3.170.0150.25151.08
5.3.160.0240.27651.08
5.3.150.0160.23151.08
5.3.140.0200.24451.08
5.3.130.0190.29851.07
5.3.120.0240.24951.06
5.3.110.0220.24251.07
5.3.100.0250.24850.56
5.3.90.0150.27250.53
5.3.80.0240.24150.52
5.3.70.0190.29150.53
5.3.60.0210.25550.51
5.3.50.0190.27150.46
5.3.40.0310.30950.46
5.3.30.0210.27350.42
5.3.20.0270.41450.20
5.3.10.0270.27150.16
5.3.00.0230.29450.15
5.2.170.0260.29146.11
5.2.160.0250.33346.11
5.2.150.0170.30046.11
5.2.140.0240.31546.11
5.2.130.0210.24646.07
5.2.120.0180.26046.07
5.2.110.0190.26446.07
5.2.100.0200.26846.07
5.2.90.0210.27546.07
5.2.80.0140.28846.06
5.2.70.0180.25146.06
5.2.60.0140.27646.02
5.2.50.0170.31545.92
5.2.40.0290.30045.89
5.2.30.0150.30746.11
5.2.20.0160.58046.11
5.2.10.0150.54046.02
5.2.00.0160.55445.88
5.1.60.0210.53658.74
5.1.50.0230.54758.74
5.1.40.0260.60458.72
5.1.30.0270.68659.07
5.1.20.0360.77459.08
5.1.10.0460.60558.82
5.1.00.0590.58458.81
5.0.50.0230.72857.29
5.0.40.0340.81357.15
5.0.30.0350.72956.97
5.0.20.0290.65556.94
5.0.10.0250.65856.91
5.0.00.0360.93456.91
4.4.90.0070.0194.78
4.4.80.0050.0144.76
4.4.70.0040.0204.75
4.4.60.0040.0204.76
4.4.50.0070.0184.77
4.4.40.0050.0284.71
4.4.30.0050.0194.76
4.4.20.0040.0224.84
4.4.10.0050.0134.84
4.4.00.0030.0254.76
4.3.110.0020.0174.67
4.3.100.0050.0134.66
4.3.90.0030.0144.64
4.3.80.0020.0244.58
4.3.70.0030.0144.63
4.3.60.0030.0144.63
4.3.50.0020.0164.63
4.3.40.0020.0244.54
4.3.30.0030.0223.30
4.3.20.0020.0213.28
4.3.10.0030.0203.24
4.3.00.0000.02015.66

preferences:
38.92 ms | 401 KiB | 5 Q