3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface IDBResult { function FetchAssoc(); function Rewind(); } class DBResult implements IDBResult { private $_records = array( array('abc' => 'def'), ); private $_i = 0; function FetchAssoc() { return $this->_records[$this->_i++]; } function Rewind() { $this->_i = 0; } } class ResultIterator implements Iterator { private $_rs; private $_index = 0; private $_onLoad; function __construct(IDBResult $rs, callable $callback = null) { $this->_rs = $rs; $this->_onLoad = $callback ?: function($rec, $i) { return $rec; }; } public function current() { return call_user_func_array($this->_onLoad, array($this->_rec, $this->_index)); } public function key() { return $this->_index; } public function next() { $this->_index++; $this->_rec = $this->_rs->FetchAssoc(); } public function rewind() { $this->_index = 0; $this->_rs->Rewind(); } public function valid() { return !is_null($this->_rec); } } $rs = new DBResult(); $it = new ResultIterator($rs); foreach($it as $rec) { print_r($rec); }

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.3.70.0130.00716.63
8.3.60.0140.00316.86
8.3.50.0150.00522.16
8.3.40.0070.00718.97
8.3.30.0070.00719.07
8.3.20.0080.00020.34
8.3.10.0080.00021.79
8.3.00.0090.00317.75
8.2.190.0080.00816.75
8.2.180.0190.00318.41
8.2.170.0100.00722.96
8.2.160.0070.00722.13
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0000.00819.64
8.2.110.0000.00920.98
8.2.100.0030.00917.63
8.2.90.0080.00019.02
8.2.80.0040.00417.97
8.2.70.0060.00617.50
8.2.60.0040.00417.80
8.2.50.0060.00318.07
8.2.40.0060.00318.15
8.2.30.0000.00817.96
8.2.20.0070.00017.73
8.2.10.0030.00518.12
8.2.00.0040.00417.75
8.1.280.0140.01025.92
8.1.270.0090.00018.86
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0080.00023.92
8.1.230.0120.00318.78
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.38
8.1.190.0040.00417.36
8.1.180.0000.00918.10
8.1.170.0040.00420.28
8.1.160.0000.00722.10
8.1.150.0040.00418.83
8.1.140.0080.00017.43
8.1.130.0000.00717.85
8.1.120.0040.00417.39
8.1.110.0000.00817.38
8.1.100.0070.00017.47
8.1.90.0070.00017.39
8.1.80.0050.00217.50
8.1.70.0040.00417.47
8.1.60.0060.00317.52
8.1.50.0040.00417.58
8.1.40.0040.00417.57
8.1.30.0080.00017.68
8.1.20.0000.00717.52
8.1.10.0000.00917.50
8.1.00.0030.00717.55
8.0.300.0040.00418.77
8.0.290.0080.00016.75
8.0.280.0030.00318.37
8.0.270.0030.00317.27
8.0.260.0000.00717.14
8.0.250.0000.00616.96
8.0.240.0000.00717.05
8.0.230.0030.00316.93
8.0.220.0070.00017.01
8.0.210.0050.00316.94
8.0.200.0060.00017.03
8.0.190.0000.00817.02
8.0.180.0070.00016.88
8.0.170.0030.00516.99
8.0.160.0000.00716.91
8.0.150.0000.00716.92
8.0.140.0040.00416.95
8.0.130.0000.00513.35
8.0.120.0030.00516.93
8.0.110.0000.00716.95
8.0.100.0000.00716.82
8.0.90.0000.00717.00
8.0.80.0100.00616.96
8.0.70.0000.00716.97
8.0.60.0080.00016.82
8.0.50.0000.00817.03
8.0.30.0090.01217.11
8.0.20.0120.01217.40
8.0.10.0040.00416.98
8.0.00.0110.00617.00
7.4.330.0050.00015.03
7.4.320.0030.00316.65
7.4.300.0070.00016.51
7.4.290.0070.00016.64
7.4.280.0030.00516.64
7.4.270.0040.00416.44
7.4.260.0000.00816.43
7.4.250.0000.00716.44
7.4.240.0070.00216.61
7.4.230.0000.00716.65
7.4.220.0080.01116.50
7.4.210.0140.00316.62
7.4.200.0050.00216.66
7.4.160.0000.01516.60
7.4.150.0130.01317.40
7.4.140.0120.00717.86
7.4.130.0060.01116.72
7.4.120.0090.00816.50
7.4.110.0040.01416.49
7.4.100.0120.00616.59
7.4.90.0120.00616.75
7.4.80.0040.01619.39
7.4.70.0120.00616.57
7.4.60.0100.01016.75
7.4.50.0030.00516.66
7.4.40.0080.00816.62
7.4.30.0120.00916.57
7.4.00.0100.00715.08
7.3.330.0060.00013.45
7.3.320.0130.00013.24
7.3.310.0040.00416.32
7.3.300.0030.00316.31
7.3.290.0030.00316.28
7.3.280.0080.01016.43
7.3.270.0100.00717.40
7.3.260.0180.00016.48
7.3.250.0080.01616.43
7.3.240.0130.00316.45
7.3.230.0130.01016.48
7.3.210.0180.00016.73
7.3.200.0110.00919.39
7.3.190.0050.01116.54
7.3.180.0140.00616.58
7.3.170.0140.01116.59
7.3.160.0070.01016.45
7.2.330.0150.00316.60
7.2.320.0060.01116.71
7.2.310.0140.00416.77
7.2.300.0120.00916.59
7.2.290.0100.01316.63
7.2.60.0140.00316.99
7.2.00.0000.01419.32
7.1.200.0050.00515.72
7.1.100.0080.00418.26
7.1.70.0000.00717.15
7.1.60.0070.01719.46
7.1.50.0170.01734.88
7.1.00.0030.07722.30
7.0.200.0100.00316.85
7.0.140.0000.04722.21
7.0.70.4300.04019.98
7.0.60.0170.06319.86
7.0.50.0030.08317.93
7.0.40.0000.08320.04
7.0.30.0270.07320.11
7.0.20.0400.06720.23
7.0.10.0070.05020.30
7.0.00.0130.08020.33
5.6.280.0000.07721.09
5.6.210.0130.07320.52
5.6.200.0030.07718.14
5.6.190.0100.08320.77
5.6.180.0270.04020.64
5.6.170.0230.08720.40
5.6.160.0070.03720.44
5.6.150.0000.05318.21
5.6.140.0100.07718.16
5.6.130.0070.05318.28
5.6.120.0100.08321.04
5.6.110.0100.07320.97
5.6.100.0130.08321.10
5.6.90.0130.07721.05
5.6.80.0070.07320.56
5.6.70.0370.06020.39
5.5.350.0070.08320.32
5.5.340.0100.04318.05
5.5.330.0070.08320.31
5.5.320.0070.08020.59
5.5.310.0230.03320.21
5.5.300.0030.07717.95
5.5.290.0100.05318.07
5.5.280.0130.07721.00
5.5.270.0200.07320.66
5.5.260.0130.06020.82
5.5.250.0130.03720.68
5.5.240.0030.07720.35
5.4.450.0230.05019.57
5.4.440.0970.05019.48
5.4.430.0900.06019.45
5.4.420.1000.04719.58
5.4.410.1000.05319.03
5.4.400.0130.05718.82
5.4.390.0270.04018.77
5.4.380.0130.05318.79
5.4.370.0100.05718.57
5.4.360.0130.05318.81
5.4.350.0230.04718.79
5.4.340.0270.04018.55
5.4.320.0230.04718.58
5.4.310.0170.05018.70
5.4.300.0070.06718.62
5.4.290.0100.06018.61
5.4.280.0170.05018.51
5.4.270.0100.05718.54
5.4.260.0170.05318.61
5.4.250.0200.05018.57
5.4.240.0200.05018.78
5.4.230.0270.04018.70
5.4.220.0200.05018.79
5.4.210.0170.05018.75
5.4.200.0270.04316.80
5.4.190.0200.04718.78
5.4.180.0200.04718.76
5.4.170.0130.06018.77
5.4.160.0100.05718.77
5.4.150.0170.04718.72
5.4.140.0170.05016.28
5.4.130.0130.04716.30
5.4.120.0170.04716.27
5.4.110.0030.05716.28
5.4.100.0200.04316.47
5.4.90.0270.03716.20
5.4.80.0170.04716.22
5.4.70.0100.05316.23
5.4.60.0170.04716.41
5.4.50.0230.03716.30
5.4.40.0130.05316.26
5.4.30.0200.04316.42
5.4.20.0200.05016.43
5.4.10.0200.04316.42
5.4.00.0130.05015.73
5.3.290.0100.05714.89
5.3.280.0230.06014.61
5.3.270.0130.05314.86
5.3.260.0170.06014.64
5.3.250.0100.05314.74
5.3.240.0130.05014.66
5.3.230.0070.06014.82
5.3.220.0130.05314.63
5.3.210.0230.05714.59
5.3.200.0200.04314.71
5.3.190.0100.05714.69
5.3.180.0130.05014.61
5.3.170.0170.04714.79
5.3.160.0130.05314.64
5.3.150.0130.05014.71
5.3.140.0270.03714.81
5.3.130.0170.05314.59
5.3.120.0170.05014.75
5.3.110.0170.05314.66
5.3.100.0130.05314.16
5.3.90.0030.06014.24
5.3.80.0130.05714.09
5.3.70.0130.05314.16
5.3.60.0130.05014.23
5.3.50.0100.05313.95
5.3.40.0070.05714.00
5.3.30.0100.05014.06
5.3.20.0070.05713.75
5.3.10.0070.06013.77
5.3.00.0070.06013.64
5.2.170.0100.04711.14
5.2.160.0170.03711.23
5.2.150.0100.05011.17
5.2.140.0170.03711.14
5.2.130.0070.04311.13
5.2.120.0130.03711.22
5.2.110.0100.05711.09
5.2.100.0100.04711.14
5.2.90.0100.04311.16
5.2.80.0100.04311.22
5.2.70.0070.04311.32
5.2.60.0130.05711.28
5.2.50.0100.05711.01
5.2.40.0100.04011.11
5.2.30.0100.04011.18
5.2.20.0070.04011.01
5.2.10.0070.04010.86
5.2.00.0130.03710.95
5.1.60.0100.03310.12
5.1.50.0130.03010.04
5.1.40.0230.0209.97
5.1.30.0100.03710.38
5.1.20.0100.04010.55
5.1.10.0070.03710.27
5.1.00.0130.03310.20
5.0.50.0100.0278.60
5.0.40.0070.0278.50
5.0.30.0000.0478.32
5.0.20.0030.0308.34
5.0.10.0100.0238.30
5.0.00.0000.0538.19
4.4.90.0000.0275.87
4.4.80.0070.0205.82
4.4.70.0030.0275.90
4.4.60.0030.0235.90
4.4.50.0070.0205.95
4.4.40.0070.0405.89
4.4.30.0070.0275.90
4.4.20.0070.0205.91
4.4.10.0030.0305.93
4.4.00.0070.0435.94
4.3.110.0000.0335.75
4.3.100.0100.0175.85
4.3.90.0030.0275.79
4.3.80.0100.0305.82
4.3.70.0070.0205.80
4.3.60.0030.0235.86
4.3.50.0030.0235.78
4.3.40.0030.0335.78
4.3.30.0030.0204.66
4.3.20.0000.0234.54
4.3.10.0070.0174.50
4.3.00.0070.0206.93

preferences:
70.23 ms | 401 KiB | 5 Q