dimanche 17 janvier 2016

Is this a good "random page" PHP code?

<?php 
    $urls = array (
    "id=1.php",
    "id=2.php",
    "id=3.php" ); 
    $random = (rand()%3); 
    header ("Location: ".$urls[$random]);
    exit;
?>

I suspect that it could be better, especially because I have to manually edit the % value every time I add a new one.




Aucun commentaire:

Enregistrer un commentaire