3v4l.org

run code in 300+ PHP versions simultaneously
<?php class InfiniteNumbers implements Iterator { public $start; public $current; public function __construct($start) { $this->start = $start; $this->current = $start; } public function next() { echo "next called\n"; $this->current++; } public function current() { echo "current called\n"; return $this->current; } public function key() { echo "key called\n"; return $this->current; } public function rewind() { echo "rewind called\n"; $this->current = $this->start; } public function valid() { echo "valid called\n"; return true; } } $infinite = new InfiniteNumbers(1); var_dump($infinite); foreach($infinite as $number) { if($number > 10) { break; } echo $number."\n"; }

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.0090.00916.75
8.3.50.0090.00916.36
8.3.40.0090.00619.02
8.3.30.0180.00018.80
8.3.20.0060.01220.14
8.3.10.0060.00921.78
8.3.00.0060.00317.50
8.2.180.0090.00618.41
8.2.170.0080.00822.96
8.2.160.0070.01019.32
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00819.83
8.2.110.0040.00420.29
8.2.100.0040.00817.88
8.2.90.0050.00319.30
8.2.80.0060.00317.97
8.2.70.0030.00617.50
8.2.60.0040.00418.22
8.2.50.0080.00018.10
8.2.40.0030.00522.34
8.2.30.0040.00419.26
8.2.20.0050.00318.12
8.2.10.0050.00218.30
8.2.00.0030.00318.19
8.1.280.0070.01125.92
8.1.270.0040.00422.07
8.1.260.0150.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.83
8.1.230.0040.00820.98
8.1.220.0030.00617.79
8.1.210.0100.00018.77
8.1.200.0000.01017.22
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0040.00418.51
8.1.160.0040.00418.93
8.1.150.0040.00420.06
8.1.140.0000.00719.50
8.1.130.0070.00018.95
8.1.120.0040.00417.54
8.1.110.0000.00717.38
8.1.100.0000.00717.40
8.1.90.0080.00017.36
8.1.80.0040.00417.44
8.1.70.0030.00317.43
8.1.60.0040.00417.62
8.1.50.0000.00717.43
8.1.40.0000.00817.52
8.1.30.0050.00317.66
8.1.20.0050.00317.50
8.1.10.0040.00417.64
8.1.00.0000.00717.42
8.0.300.0040.00418.77
8.0.290.0030.00516.63
8.0.280.0000.00718.33
8.0.270.0050.00217.26
8.0.260.0000.00719.06
8.0.250.0070.00017.00
8.0.240.0030.00316.98
8.0.230.0040.00417.01
8.0.220.0000.00716.93
8.0.210.0040.00416.80
8.0.200.0000.00916.95
8.0.190.0000.00916.91
8.0.180.0000.00716.89
8.0.170.0050.00316.97
8.0.160.0080.00016.88
8.0.150.0040.00416.84
8.0.140.0030.00316.86
8.0.130.0050.00013.29
8.0.120.0040.00416.81
8.0.110.0040.00416.80
8.0.100.0040.00416.89
8.0.90.0030.00616.90
8.0.80.0120.00616.88
8.0.70.0000.00716.95
8.0.60.0050.00216.90
8.0.50.0070.00016.73
8.0.30.0090.00817.09
8.0.20.0070.01317.40
8.0.10.0000.00717.01
8.0.00.0170.00316.77
7.4.330.0050.00015.55
7.4.320.0070.00016.62
7.4.300.0030.00316.48
7.4.290.0070.00416.42
7.4.280.0040.00416.59
7.4.270.0040.00416.38
7.4.260.0030.00616.54
7.4.250.0030.00516.56
7.4.240.0000.00716.59
7.4.230.0030.00316.26
7.4.220.0090.01616.60
7.4.210.0110.00316.52
7.4.200.0000.00716.44
7.4.160.0150.00116.47
7.4.150.0090.00917.40
7.4.140.0100.00917.86
7.4.130.0120.01116.51
7.4.120.0140.00816.46
7.4.110.0150.00916.63
7.4.100.0060.01216.36
7.4.90.0150.00416.63
7.4.80.0170.00319.39
7.4.70.0120.00916.58
7.4.60.0110.00716.73
7.4.50.0000.01616.45
7.4.40.0060.01116.39
7.4.30.0060.00916.49
7.4.00.0070.00814.95
7.3.330.0000.00513.38
7.3.320.0030.00313.22
7.3.310.0030.00316.13
7.3.300.0000.00716.18
7.3.290.0060.00816.29
7.3.280.0060.01016.27
7.3.270.0080.01017.40
7.3.260.0050.01216.58
7.3.250.0140.00816.41
7.3.240.0110.00816.43
7.3.230.0150.02216.47
7.3.210.0030.01416.58
7.3.200.0090.00916.23
7.3.190.0100.00716.32
7.3.180.0070.01116.56
7.3.170.0110.00716.65
7.3.160.0140.00616.45
7.3.120.0020.01214.92
7.3.110.0030.01114.84
7.3.100.0020.01414.79
7.3.90.0100.00514.80
7.3.80.0060.01014.93
7.3.70.0080.00514.66
7.3.60.0030.01114.88
7.3.50.0070.00414.72
7.3.40.0050.00714.76
7.3.30.0020.01114.71
7.3.20.0070.01016.61
7.3.10.0090.00516.58
7.3.00.0070.00816.62
7.2.330.0110.00716.71
7.2.320.0090.00916.77
7.2.310.0110.01116.77
7.2.300.0090.00916.52
7.2.290.0130.01016.67
7.2.250.0090.01214.95
7.2.240.0080.01115.06
7.2.230.0040.00915.21
7.2.220.0040.00914.98
7.2.210.0050.00915.05
7.2.200.0070.00415.03
7.2.190.0070.00915.03
7.2.180.0080.00815.09
7.2.170.0060.00615.06
7.2.160.0100.00714.86
7.2.150.0070.01016.87
7.2.140.0070.01016.96
7.2.130.0100.00616.76
7.2.120.0100.00416.89
7.2.110.0110.00616.82
7.2.100.0060.01216.83
7.2.90.0070.00916.87
7.2.80.0070.01016.91
7.2.70.0040.01316.86
7.2.60.0080.00716.83
7.2.50.0070.01016.71
7.2.40.0090.00816.84
7.2.30.0020.01216.75
7.2.20.0050.01116.80
7.2.10.0050.01116.79
7.2.00.0110.00416.84
7.1.330.0100.00315.73
7.1.320.0060.00815.85
7.1.310.0070.00815.81
7.1.300.0030.00915.69
7.1.290.0090.00515.56
7.1.280.0080.00715.79
7.1.270.0030.01115.60
7.1.260.0040.01015.80
7.1.250.0030.01015.56
7.1.200.0030.00715.83
7.1.70.0000.00917.07
7.1.60.0080.00317.29
7.1.40.0400.01732.42
7.1.30.0370.01732.53
7.1.20.0400.01332.58
7.1.10.0300.01014.68
7.1.00.0270.01014.52
7.0.200.0060.01316.79
7.0.180.0400.01314.40
7.0.170.0330.01014.31
7.0.160.0330.00314.30
7.0.150.0300.00714.31
7.0.140.0300.00714.38
7.0.130.0330.00714.52
7.0.120.0370.01314.65
7.0.110.0930.00714.45
7.0.100.0330.01714.41
7.0.90.0530.01014.43
7.0.80.0470.00714.27
7.0.70.0500.00714.43
7.0.60.0530.00714.40
7.0.50.0430.01314.48
7.0.40.0430.01714.50
7.0.30.0430.01314.49
7.0.20.0530.01314.43
7.0.10.0300.01314.43
7.0.00.0300.01014.62

preferences:
66.53 ms | 401 KiB | 5 Q