3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DataContainer implements IteratorAggregate { // create an external Iterator: protected $data; public function __construct(array $data) { $this->data = $data; } public function &getIterator() { foreach ($this->data as &$value) { yield $value; } } } $dataContainer = new DataContainer([77, 78, 79]); foreach ($dataContainer as &$value) { echo ($value *= -1)," "; } // Weird result from neglecting to unset $value ... foreach($dataContainer as $value){ echo $value)," "; }

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.220.0160.05212.39
5.4.210.0190.04312.39
5.4.200.0160.04712.40
5.4.190.0130.04512.39
5.4.180.0150.04312.39
5.4.170.0110.05012.40
5.4.160.0120.04612.39
5.4.150.0150.04512.39
5.4.140.0160.04612.08
5.4.130.0130.05012.06
5.4.120.0140.04512.03
5.4.110.0150.04512.03
5.4.100.0130.04712.03
5.4.90.0140.04712.03
5.4.80.0140.04612.03
5.4.70.0130.04512.02
5.4.60.0090.04912.02
5.4.50.0110.04712.02
5.4.40.0130.04512.01
5.4.30.0140.04312.01
5.4.20.0130.04612.00
5.4.10.0100.04912.01
5.4.00.0160.04311.50
5.3.270.0150.05012.72
5.3.260.0170.05012.72
5.3.250.0180.06212.72
5.3.240.0140.05112.72
5.3.230.0140.04912.71
5.3.220.0150.04912.68
5.3.210.0130.05412.68
5.3.200.0140.05212.68
5.3.190.0130.04912.68
5.3.180.0150.05012.67
5.3.170.0140.05012.67
5.3.160.0150.05012.67
5.3.150.0130.05212.67
5.3.140.0170.05012.66
5.3.130.0210.06512.66
5.3.120.0160.04912.66
5.3.110.0200.05812.65
5.3.100.0180.04712.12
5.3.90.0220.07212.10
5.3.80.0150.04612.09
5.3.70.0150.04912.09
5.3.60.0150.05112.07
5.3.50.0190.05312.02
5.3.40.0150.05212.02
5.3.30.0300.06211.98
5.3.20.0280.06211.76
5.3.10.0140.04611.72
5.3.00.0180.04211.71

preferences:
152.61 ms | 1394 KiB | 7 Q