3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A1 { var $s; protected function a () { $i =0 ; while (true) { $i++; if ($i > 10000) { break; } foreach ([['a' => 1],2, ['a' => 2]] as $p) { if ($p == 2) { continue; } if ($i %100 == 0) { $this->s .= str_repeat('0123456789', 10000); } yield $p['a'] => 123; } } } public function b(){ $sum = 0; try{ foreach ( $this->a() as $k => $v ) { $sum += $k + $v; } echo 'Done: ', $sum; } } catch (\Exception $e){} } (new A1)->b();

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)
7.0.20.0300.05720.24
7.0.10.0070.06020.22
7.0.00.0170.03320.16
5.6.170.0230.04320.58
5.6.160.0170.07320.62
5.6.150.0070.08018.29
5.6.140.0100.08018.25
5.6.130.0030.05718.28
5.6.120.0100.05021.01
5.6.110.0100.08321.14
5.6.100.0070.08320.96
5.6.90.0070.03720.99
5.6.80.0070.06020.40
5.5.310.0200.07720.37
5.5.300.0030.08718.04
5.5.290.0070.06017.95
5.5.280.0000.05020.77
5.5.270.0070.07720.87
5.5.260.0000.05720.89
5.5.250.0030.08020.59
5.5.240.0130.07720.38

preferences:
142.81 ms | 1394 KiB | 7 Q