3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyModel { } class Collection implements \ArrayAccess, \Iterator { private $storage = array(); public function offsetExists($offset) { return isset($this->storage[$offset]); } public function offsetGet($offset) { return $this->storage[$offset]; } public function offsetSet($offset, $value) { if (null === $offset) { $this->storage[] = $value; } else { $this->storage[$offset] = $value; } } public function offsetUnset($offset) { unset ($this->storage[$offset]); } public function current() { return current($this->storage); } public function next() { return next($this->storage); } public function key() { return key($this->storage); } public function valid() { return key($this->storage) !== null; } public function rewind() { reset($this->storage); } public function count() { return count($this->storage); } } class MyCollectionModel { private $collection; public function __construct() { $this->collection = new Collection(); } public function addElement($element) { $this->collection[] = $element; } public function removeMyModels() { foreach ($this->collection as $index => $value) { if ($value instanceof MyModel) { unset ($this->collection[$index]); } } } } // Создем коллекцию $myCollection = new MyCollectionModel(); // Заполняем своими можельками for ($i = 0; $i < 10; $i++) { $myCollection->addElement(new MyModel()); } // Удаляем свои модельки $myCollection->removeMyModels(); // Сука, ебучая PHP!!! print_r($myCollection);<?php

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.320.0070.05012.54
5.4.310.0090.04012.53
5.4.300.0060.03912.53
5.4.290.0070.04612.53
5.4.280.0060.04812.42
5.4.270.0080.04012.43
5.4.260.0070.04012.42
5.4.250.0070.03512.43
5.4.240.0030.03812.43
5.4.230.0040.03912.41
5.4.220.0060.03812.41
5.4.210.0080.04812.42
5.4.200.0060.03812.42
5.4.190.0050.03712.41
5.4.180.0080.03412.41
5.4.170.0020.04112.42
5.4.160.0090.03312.41
5.4.150.0060.04112.41
5.4.140.0060.04512.10
5.4.130.0090.04312.08
5.4.120.0110.03712.04
5.4.110.0080.03712.05
5.4.100.0080.03312.04
5.4.90.0060.04212.04
5.4.80.0060.04312.04
5.4.70.0050.03412.04
5.4.60.0100.04112.04
5.4.50.0050.04312.04
5.4.40.0080.04512.03
5.4.30.0080.04512.02
5.4.20.0090.03412.02
5.4.10.0070.03412.02
5.4.00.0040.03711.52
5.3.290.0050.04512.80
5.3.280.0030.04312.71
5.3.270.0050.04012.73
5.3.260.0080.04712.73
5.3.250.0090.04512.73
5.3.240.0070.04812.73
5.3.230.0100.05212.71
5.3.220.0060.04312.69
5.3.210.0060.05712.69
5.3.200.0080.04012.68
5.3.190.0070.03712.68
5.3.180.0110.03112.68
5.3.170.0100.04812.68
5.3.160.0080.05012.68
5.3.150.0130.04512.68
5.3.140.0120.03712.68
5.3.130.0110.03812.67
5.3.120.0100.04912.67
5.3.110.0090.04412.67
5.3.100.0140.03912.16
5.3.90.0040.03712.14
5.3.80.0030.03912.13
5.3.70.0060.03612.13
5.3.60.0060.04112.11
5.3.50.0070.04712.06
5.3.40.0100.03412.06
5.3.30.0070.04212.02
5.3.20.0040.04311.80
5.3.10.0070.03911.77
5.3.00.0040.04211.76
5.2.170.0030.0359.25
5.2.160.0080.0339.25
5.2.150.0040.0329.25
5.2.140.0090.0449.25
5.2.130.0050.0339.21
5.2.120.0050.0399.21
5.2.110.0070.0379.22
5.2.100.0050.0389.21
5.2.90.0030.0409.20
5.2.80.0050.0349.20
5.2.70.0060.0299.20
5.2.60.0060.0389.16
5.2.50.0060.0309.13
5.2.40.0080.0329.11
5.2.30.0090.0259.08
5.2.20.0050.0389.07
5.2.10.0100.0268.98
5.2.00.0080.0348.84
5.1.60.0050.0248.12
5.1.50.0040.0378.12
5.1.40.0070.0298.10
5.1.30.0050.0278.45
5.1.20.0010.0338.47
5.1.10.0090.0268.20
5.1.00.0100.0378.20
5.0.50.0050.0296.68
5.0.40.0020.0356.54
5.0.30.0050.0316.36
5.0.20.0030.0196.31
5.0.10.0050.0176.30
5.0.00.0030.0366.29
4.4.90.0030.0184.78
4.4.80.0040.0324.76
4.4.70.0050.0164.76
4.4.60.0040.0264.75
4.4.50.0050.0174.77
4.4.40.0030.0344.70
4.4.30.0020.0174.76
4.4.20.0020.0184.84
4.4.10.0040.0134.85
4.4.00.0050.0284.76
4.3.110.0050.0184.67
4.3.100.0030.0244.67
4.3.90.0020.0154.64
4.3.80.0030.0324.58
4.3.70.0020.0194.63
4.3.60.0050.0134.63
4.3.50.0020.0154.63
4.3.40.0050.0234.54
4.3.30.0020.0173.30
4.3.20.0020.0163.28
4.3.10.0000.0173.23
4.3.00.0000.0236.73

preferences:
140.76 ms | 1394 KiB | 7 Q