Pregunta

my php server use PHP Version 5.2.17 and php goto dont work.

how to do this loop without "goto"??

while ($i <= $dadosrolados) {
    a:
    $j = rand(1,10);
    if (isset($um) and $j == 1) {
        goto a;
    }
    else {
        $dados["Dado ".$i] = "$j";
    }
    $i++;
}
¿Fue útil?

Solución

do {
  $j = rand(1,10);
} while (isset($um) and $j == 1);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top