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 $property4; public function __construct() { $this->property4 = "last property"; } public function getIterator() : ArrayIterator { return new ArrayIterator($this); } } class myIterator implements Iterator { private $position = 0; private $array = array('one', 'two', 'three'); function rewind(): void { $this->position = 0; } function current(): mixed { return $this->array[$this->position]; } function key(): mixed { return $this->position; } function next(): void { ++$this->position; } function valid(): bool { return isset($this->array[$this->position]); } } $renderFunction = function($iterator) { foreach($iterator as $key => $value) { echo "$key: $value\n"; foreach($iterator as $key => $value) { echo " $key: $value\n"; } } }; echo "-----IteratorAggregate-----\n"; $renderFunction(new myData); echo "\n-----Iterator-----\n"; $renderFunction(new myIterator);

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)
8.4.130.0160.00518.02
8.4.120.0120.00920.76
8.4.110.0120.00822.41
8.4.100.0150.00717.61
8.4.90.0140.00820.54
8.4.80.0050.00320.80
8.4.70.0100.01218.83
8.4.60.0060.00620.58
8.4.50.0110.00819.45
8.4.40.0120.00620.45
8.4.30.0090.00922.20
8.4.20.0210.00019.56
8.4.10.0060.00321.86
8.3.260.0060.00316.57
8.3.250.0120.00718.95
8.3.240.0120.00816.66
8.3.230.0130.00616.60
8.3.220.0110.00819.16
8.3.210.0100.00518.30
8.3.200.0060.00316.57
8.3.190.0130.00717.16
8.3.180.0120.00716.86
8.3.170.0120.00618.79
8.3.160.0150.00316.69
8.3.150.0110.00816.75
8.3.140.0120.00616.69
8.3.130.0110.00416.81
8.3.120.0060.00918.57
8.3.110.0170.00316.53
8.3.100.0060.00316.75
8.3.90.0080.00018.43
8.3.80.0090.00018.68
8.3.70.0180.00016.58
8.3.60.0040.01818.30
8.3.50.0120.00616.60
8.3.40.0110.00321.99
8.3.30.0070.00718.83
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0030.00626.16
8.2.290.0100.00817.48
8.2.280.0120.00718.12
8.2.270.0070.01016.90
8.2.260.0060.00317.25
8.2.250.0000.00818.86
8.2.240.0040.00718.99
8.2.230.0000.00820.94
8.2.220.0110.00824.06
8.2.210.0130.00726.77
8.2.200.0000.00916.50
8.2.190.0120.00316.88
8.2.180.0140.00725.92
8.2.170.0110.00718.93
8.2.160.0110.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00319.76
8.2.110.0030.00622.25
8.2.100.0030.00917.84
8.2.90.0040.00417.91
8.2.80.0000.00819.28
8.2.70.0000.00817.63
8.2.60.0050.01417.50
8.2.50.0170.00217.46
8.2.40.0110.00617.63
8.2.30.0130.00417.63
8.2.20.0000.01017.38
8.2.10.0110.00517.36
8.2.00.0080.00817.50
8.1.330.0110.00722.12
8.1.320.0130.00723.61
8.1.310.0110.00316.63
8.1.300.0080.00018.46
8.1.290.0090.00030.84
8.1.280.0090.00925.92
8.1.270.0000.00923.88
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00022.45
8.1.230.0050.00520.97
8.1.220.0040.00417.79
8.1.210.0060.00318.77
8.1.200.0040.00417.35
8.1.190.0050.01117.13
8.1.180.0100.00617.25
8.1.170.0150.00317.25
8.1.160.0100.00817.13
8.1.150.0190.00017.23
8.1.140.0140.00317.13
8.1.130.0000.01717.13
8.1.120.0060.01017.38
8.1.110.0140.00617.25
8.1.100.0120.00517.25
8.1.90.0060.01017.35
8.1.80.0140.00317.13
8.1.70.0060.01117.13
8.1.60.0130.00417.37
8.1.50.0060.01217.25
8.1.40.0250.00017.50
8.1.30.0150.00317.25
8.1.20.0130.00717.60
8.1.10.0150.00517.38
8.1.00.0140.00517.38
8.0.300.0030.00519.97
8.0.290.0000.00716.63
8.0.280.0140.00416.75
8.0.270.0110.00716.60
8.0.260.0110.00616.61
8.0.250.0180.00016.52
8.0.240.0130.00416.73
8.0.230.0110.00616.62
8.0.220.0080.00816.60
8.0.210.0170.00016.63
8.0.200.0150.00316.63
8.0.190.0140.00316.52
8.0.180.0110.00816.52
8.0.170.0100.00816.60
8.0.160.0130.00516.52
8.0.150.0140.00316.63
8.0.140.0120.00616.52
8.0.130.0170.00016.52
8.0.120.0100.00716.52
8.0.110.0160.00016.52
8.0.100.0100.00716.52
8.0.90.0050.01116.52
8.0.80.0110.00616.63
8.0.70.0160.00016.52
8.0.60.0100.00716.63
8.0.50.0120.00416.62
8.0.30.0130.00316.52
8.0.20.0120.00416.52
8.0.10.0120.00416.52

preferences:
36.14 ms | 403 KiB | 5 Q