3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyArrayIter implements Iterator { private $storage; public function __construct(array $a) { $storage = $a } public function current() { return current($this->storage); } public function key() { return key($this->storage); } public function next() { next($this->storage); } public function rewind() { reset($this->storage); } public function valid() { return key($this->storage) !== null; } } $i = 1; $a = [1,2,$i,4,5]; $iter = new MyArrayIter($a); foreach($iter as &$v) { $v = 1; } var_dump($a); var_dump($iter);

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.290.0090.04312.51
5.4.280.0040.04712.41
5.4.270.0070.04212.41
5.4.260.0090.04212.41
5.4.250.0070.03812.41
5.4.240.0040.03812.41
5.4.230.0050.04112.40
5.4.220.0070.03612.40
5.4.210.0070.03612.40
5.4.200.0090.05212.40
5.4.190.0050.04512.40
5.4.180.0090.05012.40
5.4.170.0090.04312.40
5.4.160.0100.05512.40
5.4.150.0100.06412.40
5.4.140.0120.08412.09
5.4.130.0100.04812.07
5.4.120.0070.05112.03
5.4.110.0100.04312.03
5.4.100.0070.04312.03
5.4.90.0080.05012.03
5.4.80.0140.05712.03
5.4.70.0110.05612.03
5.4.60.0140.06512.03
5.4.50.0080.05212.03
5.4.40.0110.04612.01
5.4.30.0080.03912.01
5.4.20.0070.03812.01
5.4.10.0090.05412.01
5.4.00.0070.05411.50
5.3.280.0070.04512.71
5.3.270.0060.05012.72
5.3.260.0110.04312.72
5.3.250.0120.05112.72
5.3.240.0090.04612.72
5.3.230.0080.04512.71
5.3.220.0100.05612.68
5.3.210.0070.04212.68
5.3.200.0060.03912.68
5.3.190.0070.03812.68
5.3.180.0070.03812.67
5.3.170.0070.04712.67
5.3.160.0060.04612.68
5.3.150.0090.04212.67
5.3.140.0090.03912.66
5.3.130.0070.05012.66
5.3.120.0110.04712.66
5.3.110.0100.05612.66
5.3.100.0080.04212.13
5.3.90.0080.04512.10
5.3.80.0120.04312.09
5.3.70.0090.04712.09
5.3.60.0060.04512.08
5.3.50.0080.05412.03
5.3.40.0120.04512.03
5.3.30.0120.05211.98
5.3.20.0090.04411.76
5.3.10.0060.05511.73
5.3.00.0100.05511.72

preferences:
141.37 ms | 1394 KiB | 7 Q