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 = false; 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() { var_dump(__FUNCTION__); return call_user_func_array($this->_onLoad, array($this->_rec, $this->_index)); } public function key() { var_dump(__FUNCTION__); return $this->_index; } public function next() { var_dump(__FUNCTION__); $this->_index++; $this->_rec = $this->_rs->FetchAssoc(); } public function rewind() { var_dump(__FUNCTION__); $this->_index = 0; $this->_rs->Rewind(); } public function valid() { var_dump(__FUNCTION__); 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.55
8.3.50.0110.01117.98
8.3.40.0120.00318.96
8.3.30.0000.01719.04
8.3.20.0050.00320.16
8.3.10.0080.00021.74
8.3.00.0090.00317.75
8.2.180.0100.01318.66
8.2.170.0070.00722.96
8.2.160.0120.00322.13
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00419.66
8.2.110.0000.00922.16
8.2.100.0060.00617.97
8.2.90.0080.00017.97
8.2.80.0040.00418.03
8.2.70.0060.00317.63
8.2.60.0060.00317.75
8.2.50.0040.00417.75
8.2.40.0030.00617.80
8.2.30.0000.00718.04
8.2.20.0000.00817.84
8.2.10.0050.00318.16
8.2.00.0070.00017.84
8.1.280.0070.01525.92
8.1.270.0000.00918.88
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00319.12
8.1.230.0070.00320.90
8.1.220.0050.00317.74
8.1.210.0000.01118.77
8.1.200.0000.00817.35
8.1.190.0030.00617.35
8.1.180.0000.00918.10
8.1.170.0040.00417.62
8.1.160.0070.00022.01
8.1.150.0060.00318.93
8.1.140.0020.00517.43
8.1.130.0000.00717.90
8.1.120.0050.00317.45
8.1.110.0040.00417.47
8.1.100.0050.00317.54
8.1.90.0040.00417.50
8.1.80.0070.00017.47
8.1.70.0050.00317.40
8.1.60.0040.00417.58
8.1.50.0000.00817.43
8.1.40.0090.00017.59
8.1.30.0030.00517.65
8.1.20.0040.00417.65
8.1.10.0030.00617.56
8.1.00.0060.00617.55
8.0.300.0040.00419.86
8.0.290.0030.00716.75
8.0.280.0070.00018.39
8.0.270.0000.00717.28
8.0.260.0060.00017.16
8.0.250.0070.00016.95
8.0.240.0060.00017.01
8.0.230.0000.00717.02
8.0.220.0040.00417.03
8.0.210.0000.00717.02
8.0.200.0030.00316.98
8.0.190.0000.00817.09
8.0.180.0050.00216.89
8.0.170.0040.00417.02
8.0.160.0040.00416.97
8.0.150.0070.00016.96
8.0.140.0040.00416.84
8.0.130.0000.00613.43
8.0.120.0000.00816.99
8.0.110.0040.00417.02
8.0.100.0040.00416.82
8.0.90.0000.00716.98
8.0.80.0060.00916.89
8.0.70.0070.00016.84
8.0.60.0040.00416.89
8.0.50.0000.00816.96
8.0.30.0120.00917.23
8.0.20.0180.01017.40
8.0.10.0050.00216.99
8.0.00.0060.01216.94
7.4.330.0030.00315.12
7.4.320.0030.00316.52
7.4.300.0060.00016.58
7.4.290.0040.00416.54
7.4.280.0080.00016.43
7.4.270.0040.00416.46
7.4.260.0030.00316.57
7.4.250.0040.00416.45
7.4.240.0040.00416.63
7.4.230.0050.00216.73
7.4.220.0110.00816.64
7.4.210.0080.00816.60
7.4.200.0040.00416.43
7.4.160.0060.00916.64
7.4.150.0180.00817.40
7.4.140.0120.00917.86
7.4.130.0100.00716.52
7.4.120.0150.00816.69
7.4.110.0120.00616.59
7.4.100.0110.00616.37
7.4.90.0080.01116.72
7.4.80.0050.01419.39
7.4.70.0070.01416.68
7.4.60.0120.00416.46
7.4.50.0000.00516.43
7.4.40.0090.00916.48
7.4.30.0030.01416.70
7.4.00.0030.01315.15
7.3.330.0000.00513.47
7.3.320.0110.00413.37
7.3.310.0070.00016.40
7.3.300.0080.00016.30
7.3.290.0050.00316.36
7.3.280.0100.00716.42
7.3.270.0180.01817.40
7.3.260.0070.01116.31
7.3.250.0120.01016.58
7.3.240.0060.01016.61
7.3.230.0060.01116.39
7.3.210.0150.00316.64
7.3.200.0060.01119.39
7.3.190.0100.00516.50
7.3.180.0100.00716.64
7.3.170.0130.00316.49
7.3.160.0090.00916.46
7.3.120.0060.01214.85
7.3.110.0120.00615.13
7.3.100.0040.01214.81
7.3.90.0060.00314.88
7.3.80.0070.00414.89
7.3.70.0130.00315.02
7.3.60.0040.01214.88
7.3.50.0080.00414.60
7.3.40.0060.00914.89
7.3.30.0030.01014.89
7.3.20.0070.00716.78
7.3.10.0100.00716.55
7.3.00.0090.00616.91
7.2.330.0060.01116.74
7.2.320.0090.00916.84
7.2.310.0100.00616.57
7.2.300.0120.00616.91
7.2.290.0060.01816.77
7.2.250.0100.00715.36
7.2.240.0070.01115.18
7.2.230.0030.01015.31
7.2.220.0040.00815.21
7.2.210.0090.00915.06
7.2.200.0070.00715.32
7.2.190.0080.00815.18
7.2.180.0060.00915.13
7.2.170.0040.01115.01
7.2.60.0050.01116.54
7.2.00.0030.01019.54
7.1.330.0050.00815.70
7.1.320.0070.00715.79
7.1.310.0030.01015.95
7.1.300.0090.00615.74
7.1.290.0000.00915.85
7.1.280.0030.00715.88
7.1.270.0080.00415.58
7.1.260.0090.00615.82
7.1.200.0150.00315.77
7.1.100.0050.00918.09
7.1.70.0030.00517.09
7.1.60.0100.01419.46
7.1.50.0160.01934.88
7.1.00.0070.07322.43
7.0.200.0070.00316.54
7.0.140.0070.07022.01
7.0.70.3930.03719.93
7.0.60.0170.07020.11
7.0.50.0070.04017.88
7.0.40.0000.05020.20
7.0.30.0230.07020.11
7.0.20.0330.08020.23
7.0.10.0270.03320.15
7.0.00.0130.05320.16
5.6.280.0130.06020.95
5.6.210.0030.08020.48
5.6.200.0130.07718.16
5.6.190.0030.09020.47
5.6.180.0270.04020.75
5.6.170.0300.07320.45
5.6.160.0030.04020.44
5.6.150.0030.07018.30
5.6.140.0070.08018.13
5.6.130.0030.06018.18
5.6.120.0100.05721.06
5.6.110.0100.08021.02
5.6.100.0130.08021.01
5.6.90.0070.05721.12
5.6.80.0070.08320.55
5.6.70.4400.04020.39
5.5.350.0130.06320.54
5.5.340.0070.08017.96
5.5.330.0070.04020.26
5.5.320.0100.08020.27
5.5.310.0330.03020.25
5.5.300.0070.04017.93
5.5.290.0100.08017.98
5.5.280.0130.04720.98
5.5.270.0100.08020.89
5.5.260.0100.05020.81
5.5.250.0000.04320.70
5.5.240.0070.08020.18
5.4.450.0200.06019.32
5.4.440.1030.05719.55
5.4.430.0870.04719.41
5.4.420.0130.05019.47
5.4.410.0970.06719.57
5.4.400.0230.04318.79
5.4.390.0130.05718.79
5.4.380.0200.05318.75
5.4.370.0130.07018.74
5.4.360.0270.06318.88
5.4.350.0230.04718.84
5.4.340.0200.05318.71
5.4.320.0170.05318.79
5.4.310.0200.05318.75
5.4.300.0230.04718.48
5.4.290.0170.05018.80
5.4.280.0100.06018.57
5.4.270.0200.04718.77
5.4.260.0170.05318.83
5.4.250.0100.08018.76
5.4.240.0130.07318.78
5.4.230.0130.05318.50
5.4.220.0300.04018.75
5.4.210.0200.04718.70
5.4.200.0100.05716.52
5.4.190.0170.05318.50
5.4.180.0230.04718.61
5.4.170.0170.05318.46
5.4.160.0130.05318.74
5.4.150.0100.06018.55
5.4.140.0170.05016.36
5.4.130.0100.05716.24
5.4.120.0330.03316.30
5.4.110.0070.05716.33
5.4.100.0170.05016.18
5.4.90.0200.05716.22
5.4.80.0170.05316.27
5.4.70.0130.05316.21
5.4.60.0230.04316.44
5.4.50.0070.05716.25
5.4.40.0230.04316.32
5.4.30.0100.06316.24
5.4.20.0130.05716.24
5.4.10.0170.05316.39
5.4.00.0030.05715.64
5.3.290.0100.06014.71
5.3.280.0100.06014.73
5.3.270.0100.06014.66
5.3.260.0200.05014.65
5.3.250.0130.05314.84
5.3.240.0130.05314.80
5.3.230.0070.06014.64
5.3.220.0230.04314.63
5.3.210.0130.05314.72
5.3.200.0170.05314.76
5.3.190.0230.06714.59
5.3.180.0100.05714.61
5.3.170.0100.05714.72
5.3.160.0130.05014.72
5.3.150.0170.04714.62
5.3.140.0200.04714.80
5.3.130.0100.05714.67
5.3.120.0100.06014.61
5.3.110.0100.05714.60
5.3.100.0200.04714.11
5.3.90.0030.06014.10
5.3.80.0130.05314.15
5.3.70.0270.03714.25
5.3.60.0130.05014.22
5.3.50.0100.05314.20
5.3.40.0130.05014.14
5.3.30.0200.04314.03
5.3.20.0070.07013.76
5.3.10.0130.05013.80
5.3.00.0070.06013.87
5.2.170.0070.04711.25
5.2.160.0000.05011.25
5.2.150.0030.05011.15
5.2.140.0130.04011.16
5.2.130.0170.03311.14
5.2.120.0100.04711.09
5.2.110.0130.03711.21
5.2.100.0070.04311.34
5.2.90.0070.04311.24
5.2.80.0170.03711.17
5.2.70.0070.04711.20
5.2.60.0200.03711.16
5.2.50.0070.04711.13
5.2.40.0100.04011.02
5.2.30.0170.04011.20
5.2.20.0030.05011.15
5.2.10.0100.04010.92
5.2.00.0070.04310.71
5.1.60.0100.03310.01
5.1.50.0130.03310.06
5.1.40.0170.03010.18
5.1.30.0100.04010.53
5.1.20.0100.03710.48
5.1.10.0070.04010.17
5.1.00.0100.03710.12
5.0.50.0100.0238.54
5.0.40.0070.0378.43
5.0.30.0030.0608.22
5.0.20.0130.0238.24
5.0.10.0070.0308.23
5.0.00.0070.0478.18
4.4.90.0070.0305.92
4.4.80.0030.0235.93
4.4.70.0030.0235.90
4.4.60.0030.0235.92
4.4.50.0000.0275.88
4.4.40.0130.0275.92
4.4.30.0030.0235.82
4.4.20.0070.0206.00
4.4.10.0130.0135.93
4.4.00.0070.0335.91
4.3.110.0100.0175.75
4.3.100.0030.0235.84
4.3.90.0030.0205.82
4.3.80.0030.0375.79
4.3.70.0030.0235.79
4.3.60.0070.0205.91
4.3.50.0070.0205.82
4.3.40.0030.0405.80
4.3.30.0000.0234.68
4.3.20.0070.0204.56
4.3.10.0070.0174.54
4.3.00.0000.0236.93

preferences:
50.87 ms | 400 KiB | 5 Q