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++;
}
Was it helpful?

Solution

do {
  $j = rand(1,10);
} while (isset($um) and $j == 1);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top