3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface IDBResult { function FetchAssoc(); function Rewind(); function NumRows(); } 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; } function NumRows() { return count($this->_records); } } class ResultIterator implements Iterator { private $_rs; private $_rec; 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->_rec = $this->_rs->FetchAssoc(); $this->_index++; } public function rewind() { $this->_index = 0; $this->_rs->Rewind(); $this->_rec = $this->_rs->FetchAssoc(); } public function valid() { return $this->_index < $this->_rs->NumRows(); } } $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.60.0120.00318.68
8.3.50.0100.01222.04
8.3.40.0070.00719.02
8.3.30.0040.01119.21
8.3.20.0040.00420.16
8.3.10.0040.00421.90
8.3.00.0120.00017.75
8.2.180.0170.00418.34
8.2.170.0070.00722.96
8.2.160.0110.00322.20
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0080.00019.43
8.2.110.0050.00519.37
8.2.100.0070.00417.63
8.2.90.0050.00319.16
8.2.80.0040.00417.97
8.2.70.0000.00917.75
8.2.60.0030.00618.04
8.2.50.0100.00218.07
8.2.40.0060.00318.15
8.2.30.0040.00418.09
8.2.20.0080.00017.95
8.2.10.0050.00318.06
8.2.00.0040.00417.90
8.1.280.0150.00025.92
8.1.270.0030.00618.92
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00019.54
8.1.230.0090.00317.48
8.1.220.0030.00517.78
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0080.00017.35
8.1.180.0040.00418.10
8.1.170.0030.00620.43
8.1.160.0040.00422.10
8.1.150.0040.00418.89
8.1.140.0040.00417.39
8.1.130.0050.00217.93
8.1.120.0000.00717.41
8.1.110.0000.00817.51
8.1.100.0040.00417.44
8.1.90.0020.00517.39
8.1.80.0000.00717.54
8.1.70.0040.00417.45
8.1.60.0060.00317.55
8.1.50.0040.00417.44
8.1.40.0050.00317.58
8.1.30.0030.00517.70
8.1.20.0040.00417.54
8.1.10.0060.00317.48
8.1.00.0000.01117.44
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0070.00018.50
8.0.270.0030.00317.35
8.0.260.0000.00617.38
8.0.250.0000.00717.01
8.0.240.0070.00016.96
8.0.230.0070.00017.04
8.0.220.0070.00016.96
8.0.210.0030.00316.96
8.0.200.0040.00417.09
8.0.190.0040.00417.04
8.0.180.0040.00417.03
8.0.170.0000.00817.04
8.0.160.0030.00317.02
8.0.150.0000.00716.88
8.0.140.0070.00016.92
8.0.130.0030.00313.34
8.0.120.0020.00516.93
8.0.110.0030.00516.98
8.0.100.0030.00516.83
8.0.90.0000.00716.94
8.0.80.0130.00716.97
8.0.70.0040.00416.88
8.0.60.0040.00417.09
8.0.50.0000.00816.94
8.0.30.0140.00817.23
8.0.20.0170.00817.40
8.0.10.0000.00716.99
8.0.00.0030.01816.81
7.4.330.0000.00515.07
7.4.320.0000.00616.63
7.4.300.0030.00316.54
7.4.290.0030.00316.73
7.4.280.0070.00316.67
7.4.270.0070.00016.41
7.4.260.0040.00416.61
7.4.250.0070.00016.52
7.4.240.0050.00216.59
7.4.230.0030.00316.44
7.4.220.0120.00616.62
7.4.210.0070.01116.56
7.4.200.0030.00316.60
7.4.160.0060.00916.64
7.4.150.0100.01517.40
7.4.140.0060.01217.86
7.4.130.0110.01016.63
7.4.120.0130.00816.61
7.4.110.0060.01216.54
7.4.100.0100.00716.54
7.4.90.0030.01316.66
7.4.80.0090.00919.39
7.4.70.0090.00916.61
7.4.60.0100.00716.50
7.4.50.0030.00616.54
7.4.40.0060.01116.61
7.4.30.0070.01116.61
7.4.00.0070.01014.87
7.3.330.0030.00313.28
7.3.320.0120.00413.45
7.3.310.0070.00016.46
7.3.300.0040.00416.50
7.3.290.0070.00016.31
7.3.280.0060.00916.47
7.3.270.0080.01917.40
7.3.260.0090.00916.39
7.3.250.0080.01216.59
7.3.240.0100.00716.47
7.3.230.0070.01116.54
7.3.210.0090.01216.44
7.3.200.0200.00319.39
7.3.190.0060.01116.53
7.3.180.0110.00716.52
7.3.170.0110.00616.56
7.3.160.0060.01316.42
7.3.10.0100.00316.32
7.3.00.0030.00616.28
7.2.330.0100.01016.59
7.2.320.0070.01416.77
7.2.310.0060.00916.78
7.2.300.0070.01116.56
7.2.290.0130.01016.82
7.2.130.0040.00716.87
7.2.120.0080.00816.57
7.2.110.0120.00616.75
7.2.100.0030.00917.01
7.2.90.0090.01316.66
7.2.80.0070.00716.84
7.2.70.0070.00717.01
7.2.60.0040.01116.61
7.2.50.0000.01216.94
7.2.40.0070.00716.96
7.2.30.0100.00716.87
7.2.20.0030.01016.98
7.2.10.0100.01017.01
7.2.00.0050.00917.95
7.1.250.0110.00315.43
7.1.200.0090.00315.87
7.1.100.0100.01017.56
7.1.70.0000.00716.90
7.1.60.0070.01119.46
7.1.50.0250.01134.88
7.1.00.0100.07022.42
7.0.200.0040.00816.94
7.0.140.0030.05722.12
7.0.70.4470.03319.88
7.0.60.0000.07319.81
7.0.50.0070.08317.91
7.0.40.0100.08320.04
7.0.30.0170.08020.33
7.0.20.0270.06720.25
7.0.10.0200.03720.07
7.0.00.0070.08320.09
5.6.280.0030.07320.95
5.6.210.0170.07320.51
5.6.200.0070.06718.18
5.6.190.0000.09320.63
5.6.180.0270.06020.45
5.6.170.0300.05720.48
5.6.160.0030.04320.54
5.6.150.0100.06718.16
5.6.140.0070.06718.17
5.6.130.0070.07718.30
5.6.120.0170.06721.13
5.6.110.0030.09321.11
5.6.100.0130.07721.02
5.6.90.0030.07020.95
5.6.80.0030.06020.42
5.6.70.0300.05720.50
5.5.350.0030.07020.35
5.5.340.0100.08017.98
5.5.330.0030.04320.35
5.5.320.0030.07720.48
5.5.310.0130.04320.27
5.5.300.0100.08317.95
5.5.290.0100.07718.08
5.5.280.0070.07020.79
5.5.270.0100.08320.82
5.5.260.0100.03720.84
5.5.250.0030.04020.61
5.5.240.0070.08020.38
5.4.450.0170.06019.61
5.4.440.0900.05719.45
5.4.430.1030.05019.45
5.4.420.1130.06019.62
5.4.410.0870.06719.03
5.4.400.0170.05018.77
5.4.390.0070.05718.58
5.4.380.0130.05718.49
5.4.370.0170.05018.48
5.4.360.0130.05318.84
5.4.350.0230.05318.80
5.4.340.0130.05318.74
5.4.320.0170.06018.54
5.4.310.0170.05018.62
5.4.300.0200.04718.47
5.4.290.0200.04718.78
5.4.280.0200.04718.79
5.4.270.0200.04718.69
5.4.260.0100.05718.79
5.4.250.0200.05018.59
5.4.240.0300.04018.73
5.4.230.0100.05318.77
5.4.220.0200.05718.53
5.4.210.0070.08018.59
5.4.200.0130.05316.80
5.4.190.0200.04318.72
5.4.180.0200.04718.69
5.4.170.0200.05318.83
5.4.160.0130.05318.48
5.4.150.0200.04718.57
5.4.140.0130.05316.48
5.4.130.0300.03716.45
5.4.120.0170.04716.36
5.4.110.0270.04716.29
5.4.100.0170.05016.44
5.4.90.0070.05716.20
5.4.80.0130.05016.37
5.4.70.0100.05316.20
5.4.60.0100.05316.27
5.4.50.0170.04716.18
5.4.40.0100.05316.24
5.4.30.0100.05016.41
5.4.20.0230.04316.31
5.4.10.0070.05316.27
5.4.00.0200.04015.89
5.3.290.0070.06314.71
5.3.280.0030.06314.64
5.3.270.0170.05014.76
5.3.260.0170.05714.75
5.3.250.0170.05014.81
5.3.240.0130.05014.67
5.3.230.0130.05014.80
5.3.220.0200.04714.79
5.3.210.0070.06014.61
5.3.200.0100.05314.69
5.3.190.0170.05014.71
5.3.180.0100.05314.62
5.3.170.0130.05314.77
5.3.160.0200.05014.81
5.3.150.0170.05014.58
5.3.140.0230.04014.58
5.3.130.0200.05014.62
5.3.120.0030.06314.61
5.3.110.0070.06314.71
5.3.100.0130.05314.19
5.3.90.0130.05714.07
5.3.80.0130.05014.10
5.3.70.0200.04314.02
5.3.60.0200.04314.08
5.3.50.0170.05013.96
5.3.40.0200.04714.09
5.3.30.0130.05013.97
5.3.20.0070.05713.84
5.3.10.0130.05013.74
5.3.00.0070.05713.87
5.2.170.0070.04711.26
5.2.160.0100.04011.36
5.2.150.0070.04711.25
5.2.140.0070.04711.22
5.2.130.0100.04311.22
5.2.120.0070.05011.23
5.2.110.0100.04011.21
5.2.100.0130.03711.22
5.2.90.0070.04311.24
5.2.80.0030.05011.18
5.2.70.0130.04011.12
5.2.60.0200.03311.18
5.2.50.0100.04011.04
5.2.40.0130.03711.13
5.2.30.0170.03311.11
5.2.20.0100.04010.92
5.2.10.0030.04310.89
5.2.00.0130.04010.83
5.1.60.0170.02710.01
5.1.50.0030.04010.04
5.1.40.0070.0379.99
5.1.30.0000.04710.55
5.1.20.0130.03010.40
5.1.10.0000.04310.12
5.1.00.0070.03710.21
5.0.50.0100.0238.60
5.0.40.0070.0278.53
5.0.30.0130.0378.24
5.0.20.0070.0278.21
5.0.10.0070.0308.23
5.0.00.0070.0478.21
4.4.90.0100.0175.92
4.4.80.0070.0275.87
4.4.70.0030.0305.88
4.4.60.0000.0275.90
4.4.50.0000.0275.93
4.4.40.0030.0375.91
4.4.30.0000.0275.91
4.4.20.0000.0275.95
4.4.10.0000.0275.95
4.4.00.0130.0275.84
4.3.110.0070.0205.84
4.3.100.0130.0235.85
4.3.90.0070.0205.82
4.3.80.0000.0405.89
4.3.70.0030.0235.82
4.3.60.0070.0205.89
4.3.50.0000.0275.79
4.3.40.0030.0375.84
4.3.30.0070.0204.60
4.3.20.0030.0234.64
4.3.10.0000.0234.51
4.3.00.0000.0336.93

preferences:
53.34 ms | 401 KiB | 5 Q