Is there a function in PHP that allows me to reverse the order of results of a while
?
For example, I have the following code that checks for a URL.
<?php
function url_exists($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return ($code == 200);
}
$noticia=700;
while($noticia)
{
if (url_exists($url = 'http://www.exemplo.com.br/noticia_'.$noticia.'.htm'))
{
echo '<a href="'.$url.'">'.$url.'</a><br>';
$noticia++;
}
else{
break;
}
}
?>
It brings me the URL's as follows, I'd like the result to be from the highest to the smallest but I do not know if my current code would do it.