Jump to content

random question


corillo181

Recommended Posts

well you could put all the files in the directory then do a random number between 0 and the [code=php:0]count($array);[code=php:0]

then just do this:

[code=php:0]
$files = array("file1.wav","file2.wav"); //etc etc...
$random = rand(0, count($files)); //i think you may need to subtract 1 off the count or make the first thing 1...

echo <<<html
<embed src="folder/{$files[$random]}" width="125" height="16"></embed>
html;
[/code]
Link to comment
https://forums.phpfreaks.com/topic/32510-random-question/#findComment-151135
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.