3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myData implements IteratorAggregate { public $property1 = "Public property one"; public $property2 = "Public property two"; public $property3 = "Public property three"; public function __construct() { $this->property4 = "last property"; } public function getIterator() { return new ArrayIterator($this); } } $obj = new myData; echo "foreach (new \$obj)"; foreach($obj as $key => $value) { var_dump($key, $value); echo "\n"; } echo "\nforeach (new ArrayIterator(\$obj))\n" foreach(new ArrayIterator($obj) as $key => $value) { var_dump($key, $value); echo "\n"; }

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.260.0100.04312.39
5.4.250.0100.04412.39
5.4.240.0090.04212.39
5.4.230.0110.03912.38
5.4.220.0070.04112.38
5.4.210.0110.04212.38
5.4.200.0080.03912.38
5.4.190.0050.03812.38
5.4.180.0050.03912.38
5.4.170.0070.03912.39
5.4.160.0080.03612.38
5.4.150.0050.04012.38
5.4.140.0100.04112.07
5.4.130.0090.03412.05
5.4.120.0070.03912.01
5.4.110.0200.05612.01
5.4.100.0190.05612.01
5.4.90.0180.05212.01
5.4.80.0070.04112.01
5.4.70.0080.06112.01
5.4.60.0090.04512.01
5.4.50.0070.04212.00
5.4.40.0080.04411.99
5.4.30.0070.03911.99
5.4.20.0120.06211.99
5.4.10.0080.04511.99
5.4.00.0100.04611.48
5.3.280.0100.05512.71
5.3.270.0100.04612.72
5.3.260.0100.05712.72
5.3.250.0110.04612.72
5.3.240.0180.06512.72
5.3.230.0090.04212.71
5.3.220.0090.05012.68
5.3.210.0120.04712.68
5.3.200.0150.04512.68
5.3.190.0080.04612.68
5.3.180.0130.05412.68
5.3.170.0120.05012.67
5.3.160.0090.04912.67
5.3.150.0090.04912.67
5.3.140.0100.04512.66
5.3.130.0070.05212.65
5.3.120.0120.04512.66
5.3.110.0060.05312.66
5.3.100.0110.04812.12
5.3.90.0150.04312.09
5.3.80.0090.04112.08
5.3.70.0090.05312.08
5.3.60.0080.04512.07
5.3.50.0090.04512.01
5.3.40.0090.05012.01
5.3.30.0140.05411.97
5.3.20.0080.06411.75
5.3.10.0100.04311.72
5.3.00.0090.05211.70

preferences:
134.36 ms | 1394 KiB | 7 Q