3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function iterator() { for ($i = 1; $i <= 10; $i++) { echo 'pre it' . $i . PHP_EOL; //$res = yield $i; var_dump($res); } } $generator = iterator(); //foreach ($generator as $val) //{ // echo $val . PHP_EOL; // $generator->send('hi'); //}
based on DAPWi
Output for 5.0.4 - 5.0.5, 5.1.1, 5.1.3 - 5.1.4, 5.1.6 - 7.1.0
pre it1 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it2 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it3 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it4 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it5 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it6 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it7 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it8 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it9 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it10 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL
Output for 5.1.2, 5.1.5
//}pre it1 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it2 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it3 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it4 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it5 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it6 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it7 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it8 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it9 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it10 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/WUi8o on line 18
Process exited with code 255.
Output for 4.3.10 - 4.4.1, 4.4.3 - 4.4.9, 5.0.2 - 5.0.3
pre it1 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it2 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it3 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it4 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it5 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it6 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it7 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it8 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it9 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it10 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it1PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it2PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it3PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it4PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it5PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it6PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it7PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it8PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it9PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WUi8o on line 7 pre it10PHP_EOL Notice: Undefined variable: res in /in/WUi8o on line 9 NULL
Output for 4.4.2
//}pre it1 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it2 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it3 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it4 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it5 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it6 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it7 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it8 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it9 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL pre it10 Notice: Undefined variable: res in /in/WUi8o on line 9 NULL