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'), array('foo' => 'bar'), array('fizz' => 'buzz'), ); private $_i = 0; function FetchAssoc() { return isset($this->_records[$this->_i]) ? $this->_records[$this->_i++] : null; } 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, function($rec, $i) { return [$i, key($rec), $rec[key($rec)]]; }); 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.40.0110.00419.09
8.3.30.0070.00719.21
8.3.20.0000.00720.38
8.3.10.0080.00021.91
8.3.00.0070.00319.44
8.2.170.0120.00322.96
8.2.160.0070.00719.45
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0050.00319.67
8.2.110.0000.01022.20
8.2.100.0040.00817.63
8.2.90.0030.00619.17
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0080.00017.93
8.2.50.0030.00618.07
8.2.40.0020.00518.15
8.2.30.0000.00918.23
8.2.20.0060.00317.79
8.2.10.0000.00818.04
8.2.00.0000.00817.70
8.1.270.0060.00318.92
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00020.94
8.1.230.0120.00017.42
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0040.00717.38
8.1.190.0040.00417.35
8.1.180.0090.00018.10
8.1.170.0030.00620.31
8.1.160.0060.00321.97
8.1.150.0040.00419.04
8.1.140.0030.00517.49
8.1.130.0000.00717.82
8.1.120.0050.00217.52
8.1.110.0020.00517.38
8.1.100.0040.00417.46
8.1.90.0000.00717.49
8.1.80.0000.00817.48
8.1.70.0070.00017.38
8.1.60.0000.00917.63
8.1.50.0050.00217.48
8.1.40.0030.00517.43
8.1.30.0040.00417.77
8.1.20.0090.00017.61
8.1.10.0080.00017.48
8.1.00.0040.00717.57
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0070.00018.38
8.0.270.0000.00717.19
8.0.260.0000.00617.33
8.0.250.0070.00017.05
8.0.240.0030.00317.13
8.0.230.0000.00717.04
8.0.220.0040.00416.99
8.0.210.0030.00316.99
8.0.200.0000.00817.04
8.0.190.0060.00316.96
8.0.180.0050.00217.07
8.0.170.0000.00817.06
8.0.160.0040.00416.99
8.0.150.0000.00816.91
8.0.140.0000.00816.84
8.0.130.0030.00313.39
8.0.120.0060.00316.96
8.0.110.0000.00716.94
8.0.100.0040.00416.88
8.0.90.0080.00017.05
8.0.80.0100.00917.04
8.0.70.0050.00216.98
8.0.60.0040.00416.95
8.0.50.0040.00416.92
8.0.30.0160.00917.31
8.0.20.0140.01117.40
8.0.10.0040.00416.93
8.0.00.0090.01216.96
7.4.330.0000.00615.21
7.4.320.0060.00016.52
7.4.300.0050.00216.59
7.4.290.0070.00016.43
7.4.280.0030.00516.63
7.4.270.0060.00316.67
7.4.260.0030.00316.45
7.4.250.0030.00316.64
7.4.240.0020.00616.54
7.4.230.0030.00316.46
7.4.220.0060.01216.50
7.4.210.0060.01216.65
7.4.200.0030.00316.59
7.4.160.0120.00916.47
7.4.150.0160.01117.40
7.4.140.0120.01017.86
7.4.130.0100.00716.57
7.4.120.0150.00516.50
7.4.110.0100.00916.67
7.4.100.0070.01016.54
7.4.90.0180.00516.70
7.4.80.0000.01819.39
7.4.70.0060.01216.57
7.4.60.0070.01016.46
7.4.50.0030.00316.78
7.4.40.0100.00716.54
7.4.30.0090.01216.59
7.4.00.0000.01415.13
7.3.330.0000.00613.26
7.3.320.0120.00313.45
7.3.310.0070.00016.43
7.3.300.0030.00316.28
7.3.290.0000.00716.40
7.3.280.0100.00816.39
7.3.270.0110.01417.40
7.3.260.0150.00316.41
7.3.250.0090.01216.53
7.3.240.0070.01316.44
7.3.230.0060.01216.40
7.3.210.0100.01416.54
7.3.200.0150.00619.39
7.3.190.0030.01716.32
7.3.180.0110.01116.53
7.3.170.0080.00816.62
7.3.160.0170.00316.55
7.3.120.0070.01014.62
7.3.110.0100.00714.59
7.3.100.0070.00714.87
7.3.90.0000.00914.89
7.3.80.0040.00414.90
7.3.70.0000.01014.89
7.3.60.0040.01114.99
7.3.50.0070.00714.81
7.3.40.0030.00915.01
7.3.30.0030.00915.00
7.3.20.0070.00416.57
7.3.10.0080.00416.74
7.3.00.0080.00816.86
7.2.330.0130.00416.48
7.2.320.0070.01116.78
7.2.310.0070.01016.68
7.2.300.0090.01016.88
7.2.290.0120.01216.50
7.2.250.0070.01015.14
7.2.240.0030.01615.20
7.2.230.0060.00915.05
7.2.220.0000.01415.23
7.2.210.0030.01415.34
7.2.200.0040.01214.89
7.2.190.0040.00415.23
7.2.180.0070.00415.10
7.2.170.0060.00914.94
7.2.160.0090.00615.08
7.2.150.0000.01016.91
7.2.140.0070.00417.18
7.2.130.0000.01316.81
7.2.120.0070.00317.05
7.2.110.0080.00317.00
7.2.100.0000.01317.00
7.2.90.0060.01017.13
7.2.80.0100.00616.96
7.2.70.0030.01416.94
7.2.60.0090.00916.79
7.2.50.0030.01316.95
7.2.40.0060.01216.89
7.2.30.0090.00016.98
7.2.20.0070.00716.86
7.2.10.0100.00616.70
7.2.00.0040.01018.22
7.1.330.0000.01315.68
7.1.320.0100.00715.82
7.1.310.0040.00815.90
7.1.300.0030.01015.73
7.1.290.0090.00615.89
7.1.280.0080.00615.90
7.1.270.0040.00815.80
7.1.260.0070.00715.89
7.1.250.0030.00715.52
7.1.100.0270.00318.18
7.1.70.0050.00517.27
7.1.60.0100.01319.46
7.1.50.0150.00635.01
7.1.00.0100.07022.53
7.0.200.0070.00416.69
7.0.140.0070.06721.98
7.0.60.0170.04019.95
7.0.50.0030.06717.90
7.0.40.0030.06320.18
7.0.30.0230.07320.30
7.0.20.0370.07020.22
7.0.10.0330.07320.33
7.0.00.0100.08020.19
5.6.280.0130.06321.12
5.6.210.0070.08020.73
5.6.200.0000.05018.16
5.6.190.0100.06720.48
5.6.180.0300.06320.66
5.6.170.0170.06020.55
5.6.160.0100.03720.39
5.6.150.0100.07318.18
5.6.140.0070.04018.17
5.6.130.0170.06018.18
5.6.120.0070.03721.14
5.6.110.0100.03721.07
5.6.100.0130.08021.07
5.6.90.0130.08321.15
5.6.80.0100.08020.55
5.6.70.4670.04020.42
5.5.350.0030.08020.35
5.5.340.0030.04717.99
5.5.330.0100.07020.21
5.5.320.0270.08320.35
5.5.310.0230.04320.35
5.5.300.0070.07018.04
5.5.290.0030.04717.97
5.5.280.0030.04020.96
5.5.270.0000.08320.75
5.5.260.0100.08720.70
5.5.250.0170.07720.57
5.5.240.0130.06020.24
5.4.450.0600.06719.48
5.4.440.1130.05319.17
5.4.430.0900.06719.47
5.4.420.0930.07019.16
5.4.410.0800.07319.35
5.4.400.0100.08018.62
5.4.390.1000.06718.52
5.4.380.1130.06718.75
5.4.370.0330.07318.52
5.4.360.0370.06018.79
5.4.350.0200.05018.63
5.4.340.0230.05018.49
5.4.320.0270.05318.74
5.4.310.0170.05318.75
5.4.300.0230.06018.79
5.4.290.0270.05718.48
5.4.280.0100.06718.84
5.4.270.0130.05318.51
5.4.260.0230.06018.74
5.4.250.0270.06318.78
5.4.240.0430.05718.77
5.4.230.0270.05318.82
5.4.220.0130.05318.62
5.4.210.0230.05718.48
5.4.200.0300.04716.57
5.4.190.0470.03718.50
5.4.180.0270.04718.76
5.4.170.0270.05018.58
5.4.160.0200.05018.53
5.4.150.0130.05718.73
5.4.140.0130.05016.26
5.4.130.0170.05316.45
5.4.120.0300.05716.46
5.4.110.0170.05016.29
5.4.100.0200.04716.37
5.4.90.0230.04716.25
5.4.80.0330.04716.32
5.4.70.0130.05716.27
5.4.60.0230.04716.16
5.4.50.0430.03716.42
5.4.40.0130.06016.33
5.4.30.0270.05716.42
5.4.20.0500.05016.43
5.4.10.0070.05716.28
5.4.00.0270.05315.77
5.3.290.0200.05014.92
5.3.280.0100.07314.64
5.3.270.0300.07714.68
5.3.260.0230.05314.69
5.3.250.0130.06014.77
5.3.240.0100.05314.66
5.3.230.0030.07314.65
5.3.220.0170.04714.58
5.3.210.0230.06314.69
5.3.200.0130.05014.79
5.3.190.0130.05014.70
5.3.180.0130.06314.80
5.3.170.0570.04714.70
5.3.160.0130.05314.72
5.3.150.0230.05314.61
5.3.140.0370.03314.79
5.3.130.0230.05314.75
5.3.120.0070.06014.63
5.3.110.0300.04714.75
5.3.100.0170.06014.25
5.3.90.0200.06014.05
5.3.80.0300.04014.12
5.3.70.0300.05714.08
5.3.60.0330.04014.06
5.3.50.0100.05714.01
5.3.40.0230.05014.11
5.3.30.0230.06013.97
5.3.20.0230.05013.86
5.3.10.0230.04713.79
5.3.00.0170.06713.89
5.2.170.0030.06711.18
5.2.160.0170.05011.20
5.2.150.0070.06011.18
5.2.140.0200.04311.15
5.2.130.0270.04311.19
5.2.120.0130.04011.22
5.2.110.0200.04011.21
5.2.100.0130.04011.14
5.2.90.0170.03311.14
5.2.80.0270.05011.21
5.2.70.0070.04311.09
5.2.60.0200.03711.20
5.2.50.0270.05711.14
5.2.40.0770.05311.05
5.2.30.0200.03711.09
5.2.20.0270.02711.04
5.2.10.0330.05310.98
5.2.00.0130.04010.91
5.1.60.0230.02310.05
5.1.50.0230.03010.19
5.1.40.0170.0439.98
5.1.30.0170.05710.57
5.1.20.0070.03710.58
5.1.10.0070.03710.17
5.1.00.0030.04310.22
5.0.50.0070.0308.61
5.0.40.0170.0208.57
5.0.30.0200.0608.26
5.0.20.0070.0378.22
5.0.10.0100.0338.41
5.0.00.0230.0508.33
4.4.90.0070.0275.91
4.4.80.0000.0275.87
4.4.70.0070.0205.86
4.4.60.0170.0235.82
4.4.50.0070.0205.89
4.4.40.0070.0435.89
4.4.30.0030.0235.88
4.4.20.0030.0275.95
4.4.10.0070.0205.88
4.4.00.0170.0335.95
4.3.110.0070.0235.80
4.3.100.0170.0205.75
4.3.90.0000.0275.80
4.3.80.0070.0335.80
4.3.70.0070.0205.77
4.3.60.0100.0205.79
4.3.50.0100.0175.81
4.3.40.0030.0335.77
4.3.30.0030.0234.59
4.3.20.0000.0234.66
4.3.10.0030.0204.50
4.3.00.0030.0236.93

preferences:
51.42 ms | 400 KiB | 5 Q