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) { $s .= str_repeat('0123456789', 1000000); } yield $p['a'] => 123; } } }} public function b(){ $sum = 0; foreach ( a() as $k => $v ) { $sum += $k + $v; } echo 'Done: ', $sum; }} (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.0170.04320.10
7.0.10.0130.08320.44
7.0.00.0100.03320.05
5.6.170.0200.05720.47
5.6.160.0030.08720.55
5.6.150.0030.07318.16
5.6.140.0100.05018.15
5.6.130.0030.08318.23
5.6.120.0130.07020.99
5.6.110.0030.09021.11
5.6.100.0100.06021.14
5.6.90.0100.06721.10
5.6.80.0100.05320.42
5.5.310.0200.08720.27
5.5.300.0070.03717.94
5.5.290.0000.04718.08
5.5.280.0070.06720.77
5.5.270.0030.04320.84
5.5.260.0070.03720.77
5.5.250.0000.06020.51
5.5.240.0170.07320.26

preferences:
137.25 ms | 1394 KiB | 7 Q