Quantcast
Channel: Why does this PHP function cycle endlessly? - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by raidenace for Why does this PHP function cycle endlessly?

Other than the = to == you were also resetting the $Recurring in the wrong place: <? function nonrecgen($min, $max, $amount) { for($i=0;$i<$amount;$i++) { $NrArray[$i] = rand($min,$max); do {...

View Article



Answer by tigrang for Why does this PHP function cycle endlessly?

You're currently assigning a value rather than checking (which will always be true). Change it to: while ($Reccuring == true);

View Article

Answer by andrewsi for Why does this PHP function cycle endlessly?

do { ... } while ($Reccuring = true); Because your while statement sets $Reccuring to true, instead of evaluating it. Try: do { ... } while ($Reccuring === true);

View Article

Why does this PHP function cycle endlessly?

function nonrecgen($min, $max, $amount) { for($i=0;$i<$amount;$i++) { $NrArray[$i] = rand($min,$max); echo $NrArray[$i]; do { for($j=0;$j<=$i;$j++) { if ($NrArray[$j] == $NrArray[$i]) {...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images