3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { echo '1' . (yield 1) . '|'; echo '2' . (yield 2). '|'; } $val = test(); var_dump($val->current()); $val->send('ok'); val->next() $val->send('ok'); //echo "|" . $val->current() . "|"; //$val->send('yes'); //echo "|" . $val->current() . "|"; //$val->next(); //$val->current(); //$val->send('no'); //echo "|" . $val->current() . "|";
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '1' (T_LNUMBER) in /in/7A2Be on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_LNUMBER in /in/7A2Be on line 5
Process exited with code 255.

preferences:
170.75 ms | 1395 KiB | 61 Q