3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected function a () { $i =0 ; while (true) { $i++; if ($i > 10000) { break; } foreach ([['a' => 1],2, ['a' => 2]] as $p) { if ($p == 2) { continue; } yield $p['a'] => 123; } } }} public function b(){ $sum = 0; foreach ( a() as $k => $v ) { $sum += $k + $v; } echo 'Done: ', $sum; }} (new A)->b();
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in /in/IfKjD on line 16
Process exited with code 255.
Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/IfKjD on line 16
Process exited with code 255.

preferences:
165.15 ms | 1395 KiB | 28 Q