I have a question about php include. Here goes the existing code that i have.
<?php
srand();
$files = array("content1.php", "content2.php", "content3.php", "content4.php");
$rand = array_rand($files);
include ($files[$rand]);
?>
This code actually works very well for me now as the content displaying randomly. But, i would like to get something better. Because, by using this code, everytime i have added a new content like content5.php, content6.php and so on, i have to bother to update the code above to make new content.php appear.
Is there any solution i can have, to not to bother the code above everytime i add a new content.php and the new content.php appears automatically when added? Is it possible?
Aucun commentaire:
Enregistrer un commentaire