3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * My results: * * Average time to process 10,000 items, 100 runs * * Array:: 0.0034920692443848 * Obj: 0.026956255435944 */ /** * Class foo */ class Foo { /** * @var */ protected $bar; /** * Builds it. * * @param mixed $bar * Something bar */ public function __construct($bar) { $this->bar = $bar; } /** * Something. * * @return mixed * Something */ public function getBar() { return $this->bar; } } $foo['bar'] = 'baz'; $baz = new Foo('baz'); $cycles = 10000; $array = $obj = array(); for ($j = 0; $j < 100; $j++) { $start = microtime(TRUE); for ($i = 0; $i < $cycles; $i++) { $b = $foo['bar']; } $array[] = microtime(TRUE) - $start; $start = microtime(TRUE); for ($i = 0; $i < $cycles; $i++) { $b = $baz->getBar(); } $obj[] = microtime(TRUE) - $start; } echo "Array: "; echo array_sum($array) / count($array); echo "\n\nObject: "; echo array_sum($obj) / count($obj);

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.0030.07119.10
7.1.70.0030.05917.23
7.1.60.0100.12119.46
7.1.50.0070.13116.77
7.1.00.0070.15322.54
7.0.200.0000.07016.51
7.0.140.0070.18021.95
7.0.60.0100.14720.02
7.0.50.0000.14317.90
7.0.40.0030.10320.24
7.0.30.0230.11320.16
7.0.20.0230.14020.16
7.0.10.0070.09720.10
7.0.00.0030.10020.27
5.6.280.0170.23021.00
5.6.210.0030.16720.66
5.6.200.0100.23718.23
5.6.190.0000.18020.45
5.6.180.0470.21720.48
5.6.170.0230.22020.49
5.6.160.0030.18320.43
5.6.150.0070.16718.27
5.6.140.0000.20318.28
5.6.130.0070.22318.18
5.6.120.0130.22021.12
5.6.110.0100.22721.01
5.6.100.0230.22721.05
5.6.90.0170.22721.02
5.6.80.0030.17020.43
5.5.350.0030.17720.50
5.5.340.0070.19317.93
5.5.330.0030.21320.19
5.5.320.1270.16720.32
5.5.310.0130.18320.23
5.5.300.0000.17318.04
5.5.290.0030.18718.04
5.5.280.0100.23020.98
5.5.270.0070.19320.84
5.5.260.0000.17320.74
5.5.250.0170.20020.63
5.5.240.0000.16720.29
5.4.450.0400.13719.54
5.4.440.0400.14319.32
5.4.430.0030.15019.18
5.4.420.0770.21019.45
5.4.410.0500.16719.42
5.4.400.0400.18019.00
5.4.390.0570.13719.16
5.4.380.0530.21719.21
5.4.370.0630.21718.86
5.4.360.0770.22319.13
5.4.350.0800.13718.86
5.4.340.0570.20019.14
5.4.320.0600.17319.31
5.4.310.0530.16319.14
5.4.300.0700.13318.85
5.4.290.1170.20018.98
5.4.280.0370.19019.05
5.4.270.0400.18319.22
5.4.260.0430.15718.83
5.4.250.0600.13318.96
5.4.240.0530.18318.98
5.4.230.0570.20319.02
5.4.220.0870.20719.15
5.4.210.0470.26718.96
5.4.200.0670.15719.05
5.4.190.0100.17018.96
5.4.180.0930.13718.98
5.4.170.0470.21319.12
5.4.160.0470.17319.12
5.4.150.0270.20319.04
5.4.140.0470.14016.52
5.4.130.0770.21716.33
5.4.120.0800.18016.52
5.4.110.0630.14016.59
5.4.100.0600.17716.44
5.4.90.0500.14316.57
5.4.80.0670.21316.43
5.4.70.0570.15716.38
5.4.60.0530.20716.24
5.4.50.0570.18716.25
5.4.40.0530.18716.54
5.4.30.0770.14716.50
5.4.20.0530.19316.36
5.4.10.0370.16716.33
5.4.00.0530.17716.22
5.3.290.0800.26715.77
5.3.280.0500.36016.22
5.3.270.0530.32016.22
5.3.260.0730.26016.22
5.3.250.0670.26016.22
5.3.240.0830.30716.22
5.3.230.0700.21016.22
5.3.220.1300.27316.22
5.3.210.0800.31716.22
5.3.200.0800.33316.22
5.3.190.0700.31016.22
5.3.180.0670.26316.22
5.3.170.0770.22716.22
5.3.160.0430.24016.22
5.3.150.0600.27316.22
5.3.140.0230.26016.22
5.3.130.0670.25016.22
5.3.120.0500.29716.22
5.3.110.0700.27016.22
5.3.100.0500.32716.22
5.3.90.0470.22016.22
5.3.80.0630.24716.22
5.3.70.0700.28316.22
5.3.60.0430.29016.22
5.3.50.0600.29716.22
5.3.40.0530.26316.22
5.3.30.0500.29016.22
5.3.20.0570.33316.22
5.3.10.0570.31016.22
5.3.00.0730.23016.22
5.2.170.0530.47716.22
5.2.160.0630.31016.22
5.2.150.0530.41016.22
5.2.140.0600.27016.22
5.2.130.0070.24316.22
5.2.120.0270.34316.22
5.2.110.0700.32316.22
5.2.100.0670.30016.22
5.2.90.0630.37316.22
5.2.80.0470.31316.22
5.2.70.0470.27716.22
5.2.60.1330.28016.22
5.2.50.1170.33316.22
5.2.40.0530.29316.22
5.2.30.0330.27016.22
5.2.20.0530.30316.22
5.2.10.0700.32716.21
5.2.00.0470.38716.21
5.1.60.0600.36716.21
5.1.50.0730.30716.21
5.1.40.0500.31016.21
5.1.30.0470.28016.21
5.1.20.0530.32316.21
5.1.10.0500.27016.21
5.1.00.0570.31716.21
5.0.50.0270.58716.21
5.0.40.0230.54016.21
5.0.30.0230.60316.21
5.0.20.0200.58016.21
5.0.10.0170.56016.21
5.0.00.0300.56016.21
4.4.90.0130.01316.22
4.4.80.0130.01716.22
4.4.70.0200.02316.22
4.4.60.0070.01316.22
4.4.50.0400.01716.22
4.4.40.0230.02716.21
4.4.30.0000.01316.21
4.4.20.0200.01316.21
4.4.10.0130.01716.21
4.4.00.0100.02716.21
4.3.110.0100.01316.21
4.3.100.0030.01716.21
4.3.90.0170.01316.21
4.3.80.0270.01716.21
4.3.70.0130.01316.21
4.3.60.0270.02016.21
4.3.50.0130.01316.21
4.3.40.0100.02716.21
4.3.30.0030.02016.21
4.3.20.0030.01716.21
4.3.10.0130.01716.21
4.3.00.0170.01316.21

preferences:
33.95 ms | 400 KiB | 5 Q