Question du test PHP7

Écrire un code PHP qui affiche 1, 2, 3, 4

Intermédiaire

Que va afficher ce code ?

<?php
function gen()
{
    yield 1;
    yield 2;
    yield from gen2();
}

function gen2()
{
    yield 3;
    yield 4;
}

foreach (gen() as $val)
{
    echo $val, PHP_EOL;
}
Auteur: Julien BreuxStatut : PubliéeQuestion passée 1036 fois
Modifier
0
Évaluations de la communautéPersonne n'a encore évalué cette question, soyez le premier !