Answered
Limit a while loop
Is there a way to write this where it will limit the number of times that it runs - say 20 times?
while($p_link = array_search("0", $links))
{
$links[$p_link] = "1";
// do this
}
Is there a way to write this where it will limit the number of times that it runs - say 20 times?
while($p_link = array_search("0", $links))
{
$links[$p_link] = "1";
// do this
}
If you do get some time, can you explain this:
num_results = ($num_results > 20) ? 20 : $num_results;
Not sure I understand the ? 20 : $num_results; part.
Thanks
It uses the ternary operator.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.