php script for random include?

Acrobot

New member
Hi,
I dont know much about php programming, but I want to write a line of code that will include a random file in a folder.

for example there are the following files:
/files/1file.php
/files/2file.php
/files/3file.php

now when the script loads i would like it to choose a random php file to display. For example the code might be something like

include '(random number 1 through 3)files.php';

please let me know how to do this.
thanks
Any more information on how to get the random number, thanks for what you posted so far
Would this work?

$randomNumber = rand(5, 15);

$filename = "/files/".$randomNumber."file.php";

include("$filename");
 
Back
Top