<?php
function generate(){
if (rand(0,2))
yield 1;
return 1;
}
foreach (generate() as $k)
var_dump($k);
?>
- Output for 7.0.0 - 7.0.2, 7.0.4, 7.0.6 - 7.0.8, 7.0.10 - 7.0.14, 7.1.0, 7.1.6 - 7.1.26, 7.1.28 - 7.1.30, 7.1.32 - 7.1.33, 7.2.1 - 7.2.2, 7.2.5, 7.2.7 - 7.2.12, 7.2.15, 7.2.17 - 7.2.21, 7.2.23, 7.3.0 - 7.3.1, 7.3.3 - 7.3.9, 7.3.11 - 7.3.12
- int(1)
- Output for 7.0.3, 7.0.5, 7.0.9, 7.0.20, 7.1.5, 7.1.27, 7.1.31, 7.2.0, 7.2.3 - 7.2.4, 7.2.6, 7.2.13 - 7.2.14, 7.2.16, 7.2.22, 7.2.24, 7.3.2, 7.3.10
- Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
- Fatal error: Generators cannot return values using "return" in /in/NFBHW on line 5
Process exited with code 255. - Output for 5.4.0 - 5.4.45
- Parse error: syntax error, unexpected '1' (T_LNUMBER) in /in/NFBHW on line 4
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected T_LNUMBER in /in/NFBHW on line 4
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_LNUMBER in /in/NFBHW on line 4
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/NFBHW on line 4
Process exited with code 255.
preferences:
179.75 ms | 401 KiB | 262 Q