3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $val; public function __construct($val) { $this->val = $val; } } $storage = new SplObjectStorage; $expected = 10; // 10 iterations is expected, as storage has 10 objects attached for($i = 1; $i <= $expected; $i++) { $storage->attach(new A($i)); } $iterations = 0; $storage->rewind(); while ($storage->valid()) { $iterations++; $object = $storage->current(); echo 'Iteration #' . $iterations . ' with object A(' . $object->val . ')'; $storage->next(); if($iterations === 2 || $iterations === 8) { echo ' - deleted Object A(' . $object->val . ') '; . PHP_EOL; $storage->detach($object); // continue; } echo PHP_EOL; } if(count($storage) != $iterations) { echo 'Error! - too much iterations!' . PHP_EOL; } else { echo 'Success - there was 10 iterations as expected.' . PHP_EOL; }

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.190.0120.03912.40
5.4.180.0160.03612.40
5.4.170.0100.04112.41
5.4.160.0160.03612.40
5.4.150.0100.04212.39
5.4.140.0110.04212.09
5.4.130.0110.04112.07
5.4.120.0130.03812.03
5.4.110.0120.03912.03
5.4.100.0130.04112.03
5.4.90.0110.04212.03
5.4.80.0110.04312.03
5.4.70.0190.06212.02
5.4.60.0120.03812.03
5.4.50.0110.04312.02
5.4.40.0080.04212.01
5.4.30.0100.03912.01
5.4.20.0110.03812.01
5.4.10.0140.03412.01
5.4.00.0120.03611.50
5.3.270.0130.03912.72
5.3.260.0130.04112.72
5.3.250.0100.04212.72
5.3.240.0130.04112.72
5.3.230.0130.03912.71
5.3.220.0130.04012.68
5.3.210.0140.03812.68
5.3.200.0120.04012.68
5.3.190.0150.03612.68
5.3.180.0110.04012.67
5.3.170.0110.04012.67
5.3.160.0120.04012.67
5.3.150.0120.04012.68
5.3.140.0130.03912.66
5.3.130.0090.04312.66
5.3.120.0120.04112.66
5.3.110.0110.04212.66
5.3.100.0120.04012.12
5.3.90.0080.04312.10
5.3.80.0100.04112.10
5.3.70.0100.04212.09
5.3.60.0080.04312.08
5.3.50.0120.04112.03
5.3.40.0110.04112.03
5.3.30.0120.04011.99
5.3.20.0130.04211.77
5.3.10.0120.04011.73
5.3.00.0120.03811.72

preferences:
139.26 ms | 1394 KiB | 7 Q