Hi, I have an array like so.


$movies = array();

$movies['id246'] = "blue.html";
$movies['id252'] = "red.html";
$movies['id253'] = "green.html";
$movies['id355'] = "black.html";
$movies['id55'] = "yellow.html";


when a variable is passed say "index.php?id=id355" I have this code that
inserts an include:

include ("mydirectory/".$movies[$HTTP_GET_VARS['id']]);

Now, I've been told how to detect if a value if it is not in the array.
However, now I'd like to use the array above to generate a random include if
a id is not present. Like "index.php?id=whoops"...

My question is how do I generate the [sqaure bracketed] value ramdomly. I've
figured out how to generate the actual value (ie. "colour.html") by using
something like:

$i = array_rand($movies);
$randomfile = $movies[$i];

but I need to grab the "id" number in the square brackets instead of the
actual value. Is this possible? so instead of $random file = "black.html"
I'd like $randomfile = "id55".

many thanks