3v4l.org

run code in 300+ PHP versions simultaneously
<?php class values implements Iterator { private $_data = null; // array or object private $_keys = array(); private $_key = false; public function __construct($data = null){ $this->_data = $data; } public function current(){ return $this->_data->{"{$this->_key}"}; } public function key(){ return $this->_key; } public function next(){ $this->_key = next($this->_keys); } public function rewind(){ $this->_keys = array(); foreach ($this->_data as $k => $v){ $this->_keys[] = $k; } $this->_key = reset($this->_keys); } public function valid(){ if (false === $this->_key){ return false; } return isset($this->_data->{"{$this->_key}"}); } } $values = new values(new DateTime()); for ($i = 0; $i < 1000; $i++){ foreach($values as $k => $v) { var_dump($k, $v); } }

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.0110.01118.67
8.3.50.0100.00821.33
8.3.40.0060.00918.96
8.3.30.0070.00720.21
8.3.20.0000.01820.21
8.3.10.0050.00321.04
8.3.00.0150.00422.35
8.2.180.0130.00916.88
8.2.170.0070.01422.96
8.2.160.0100.00322.21
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00020.91
8.2.110.0090.00920.52
8.2.100.0000.01217.84
8.2.90.0000.00819.17
8.2.80.0040.00417.97
8.2.70.0090.00017.63
8.2.60.0070.00418.01
8.2.50.0040.00418.07
8.2.40.0000.00818.34
8.2.30.0040.00419.46
8.2.20.0040.00417.86
8.2.10.0030.00517.91
8.2.00.0080.00418.02
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0120.00628.09
8.1.240.0070.00322.04
8.1.230.0080.00317.71
8.1.220.0040.00417.91
8.1.210.0090.00318.77
8.1.200.0030.00617.48
8.1.190.0000.00817.66
8.1.180.0000.00818.10
8.1.170.0000.00818.83
8.1.160.0030.00518.94
8.1.150.0080.00018.72
8.1.140.0000.00817.57
8.1.130.0000.00817.91
8.1.120.0040.00417.57
8.1.110.0040.00417.67
8.1.100.0040.00417.69
8.1.90.0020.00517.55
8.1.80.0000.00917.73
8.1.70.0040.00417.63
8.1.60.0030.00617.74
8.1.50.0040.00417.72
8.1.40.0040.00417.52
8.1.30.0000.00917.79
8.1.20.0000.00817.83
8.1.10.0040.00417.72
8.1.00.0030.00517.74
8.0.300.0050.00518.77
8.0.290.0000.00817.00
8.0.280.0050.00218.59
8.0.270.0000.00717.30
8.0.260.0050.00217.09
8.0.250.0000.01117.05
8.0.240.0000.00817.15
8.0.230.0000.00717.08
8.0.220.0000.00717.09
8.0.210.0040.00417.05
8.0.200.0000.00717.11
8.0.190.0030.00617.04
8.0.180.0000.00817.16
8.0.170.0040.00417.14
8.0.160.0040.00417.11
8.0.150.0020.00517.08
8.0.140.0040.00417.06
8.0.130.0000.00613.53
8.0.120.0080.00017.01
8.0.110.0000.00717.09
8.0.100.0050.00316.92
8.0.90.0000.00817.02
8.0.80.0070.01017.11
8.0.70.0050.00317.05
8.0.60.0030.00516.96
8.0.50.0000.00816.97
8.0.30.0120.01117.14
8.0.20.0080.01117.44
8.0.10.0050.00217.29
8.0.00.0110.01017.07
7.4.330.0030.00314.91
7.4.320.0030.00316.56
7.4.300.0060.00016.71
7.4.290.0070.00016.68
7.4.280.0000.00816.73
7.4.270.0030.00316.76
7.4.260.0000.00513.38
7.4.250.0080.00016.64
7.4.240.0060.00216.75
7.4.230.0070.00016.75
7.4.220.0090.01716.62
7.4.210.0060.01216.76
7.4.200.0000.00716.42
7.4.190.0040.00416.86
7.4.160.0070.01116.62
7.4.150.0120.00617.40
7.4.140.0100.01117.86
7.4.130.0110.00916.67
7.4.120.0080.01116.57
7.4.110.0120.00416.54
7.4.100.0030.01316.65
7.4.90.0110.00716.54
7.4.80.0080.00819.39
7.4.70.0030.01316.82
7.4.60.0030.01516.55
7.4.50.0030.00516.65
7.4.40.0060.00922.77
7.4.30.0180.00316.67
7.3.330.0050.00313.23
7.3.320.0030.00913.26
7.3.310.0080.00416.32
7.3.300.0040.00816.34
7.3.290.0190.02716.43
7.3.280.0230.03216.39
7.3.270.0230.01617.40
7.3.260.0460.02918.24
7.3.250.0190.03616.58
7.3.240.0670.03716.53
7.3.230.0890.04416.64
7.3.210.0130.02016.44
7.3.200.0560.02719.39
7.3.190.0410.02216.47
7.3.180.0330.02716.70
7.3.170.0350.02316.62
7.3.160.0400.03416.55
7.2.330.0590.03616.77
7.2.320.0290.03316.72
7.2.310.0840.03116.76
7.2.300.0340.03916.59
7.2.290.0220.01916.95
7.2.100.0880.01614.89
7.2.90.0710.03114.96
7.2.80.1010.00514.60
7.2.70.0300.02414.81
7.2.60.1140.01914.67
7.2.50.0160.01214.86
7.2.40.0340.01814.96
7.2.30.1660.01514.91
7.1.220.1170.01814.08
7.1.210.0380.01514.02
7.1.200.0810.01413.75
7.1.190.0900.02114.07
7.1.180.1580.00913.75
7.1.170.0900.01913.68
7.1.160.0970.02013.79
7.1.150.1000.02013.92
7.0.310.0650.03413.64
7.0.300.0650.01913.71
7.0.290.1080.01513.61
7.0.280.1040.00713.62
5.6.380.0310.01414.64
5.6.370.0230.03014.43
5.6.360.0240.00514.22
5.6.350.0350.02914.18

preferences:
37.33 ms | 401 KiB | 5 Q