Question

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++;
}
Était-ce utile?

La solution

do {
  $j = rand(1,10);
} while (isset($um) and $j == 1);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top