repl.it
@acwoss/

NeedyVirtualCodeview

PHP (Legacy)

No description

fork
loading
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
function dobleForeach($arr) {
    foreach($arr as $item) {
        yield $item;
        yield $item;
    }
}

$teste = array(1,2,3,4);
$iterator = dobleForeach($teste);

foreach ($iterator as $c) {
    echo $c;
}
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7