3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MenuLinkTreeElement { public $link; public $subtree; public $depth; public $hasChildren; public $inActiveTrail; public $access; public $options; public function __construct($link, $has_children, $depth, $in_active_trail, array $subtree) { $this->link = $link; $this->hasChildren = $has_children; $this->depth = $depth; $this->subtree = $subtree; $this->inActiveTrail = $in_active_trail; $this->access = NULL; $this->options = array(); } public function count() { $sum = function ($carry, MenuLinkTreeElement $element) { return $carry + $element->count(); }; return 1 + array_reduce($this->subtree, $sum); } } $input = array( ); $array_start = microtime(TRUE); $storage = array(); for ($i = 0; $i < 1000; $i++) { $storage[] = array( 'link' => new StdClass(); 'has_children' => TRUE, 'depth' => 3, 'in_active_trail' => FALSE, 'below' => array(), 'access' => NULL, 'options' => array(), ); } $array_time = microtime(TRUE) - $array_start; $object_start = microtime(TRUE); $storage = array(); for ($i = 0; $i < 1000; $i++) { $storage[] = new MenuLinkTreeElement(new StdClass(), TRUE, 3, FALSE, array()); } $object_time = microtime(TRUE) - $object_start; echo 'arrays: ' . number_format($array_time, 3) . ' s'; echo 'objects: ' . number_format($object_time, 3) . ' s';

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)
5.4.300.0070.06112.53
5.4.290.0090.05012.52
5.4.280.0070.04912.42
5.4.270.0100.04912.42
5.4.260.0110.04512.41
5.4.250.0140.06812.42
5.4.240.0100.04112.42
5.4.230.0070.04412.41
5.4.220.0070.04312.41
5.4.210.0090.04512.41
5.4.200.0120.05212.41
5.4.190.0090.06012.41
5.4.180.0080.05012.40
5.4.170.0090.05412.41
5.4.160.0110.05612.41
5.4.150.0090.04512.41
5.4.140.0070.04712.10
5.4.130.0060.04612.08
5.4.120.0070.04212.04
5.4.110.0090.04112.04
5.4.100.0090.03912.04
5.4.90.0110.04312.04
5.4.80.0120.04312.04
5.4.70.0120.04912.03
5.4.60.0080.03812.03
5.4.50.0040.03912.03
5.4.40.0060.04112.02
5.4.30.0080.03612.02
5.4.20.0090.03612.02
5.4.10.0080.03712.02
5.4.00.0040.04111.51
5.3.280.0040.04212.71
5.3.270.0080.04512.72
5.3.260.0100.04512.72
5.3.250.0070.03712.72
5.3.240.0040.04012.72
5.3.230.0050.03812.71
5.3.220.0040.04012.68
5.3.210.0070.04012.68
5.3.200.0080.04112.68
5.3.190.0050.04612.68
5.3.180.0050.04312.67
5.3.170.0090.04112.67
5.3.160.0080.05412.67
5.3.150.0090.04812.67
5.3.140.0070.05212.66
5.3.130.0090.05012.66
5.3.120.0070.05112.66
5.3.110.0120.04712.66
5.3.100.0070.05312.14
5.3.90.0090.04512.12
5.3.80.0070.04312.11
5.3.70.0090.04212.11
5.3.60.0090.04112.09
5.3.50.0090.04712.04
5.3.40.0100.04512.04
5.3.30.0100.04412.00
5.3.20.0100.04511.78
5.3.10.0080.04111.75
5.3.00.0080.04711.73

preferences:
141.22 ms | 1394 KiB | 7 Q