This is a discussion on RE: [PHP] Am I dreaming or what :) within the PHP General forums, part of the PHP Programming Forums category; John Taylor-Johnston <mailto:taylorjo@collegesherbrooke.qc.ca> on Thursday, September 04, 2003 4:57 PM said: > ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
John Taylor-Johnston <mailto:taylorjo@collegesherbrooke.qc.ca>
on Thursday, September 04, 2003 4:57 PM said: > But how do i get $files ? What do you mean "get $files"? This line right here: >> $files = split("\n",`ls *gif`); "get"'s $files. Try print_r($files); and see what happens. Chris. > thanks :) > John > > Raditha Dissanayake wrote: > >> this is in fact pretty easy. >> this should get you started >> >> Code:
>> $files = split("\n",`ls *gif`);
>> srand((double)microtime()*1000000);
>>
>> $num = rand(0, count($files));
>> echo "$num = $files[$num]";
>>
>> John Taylor-Johnston wrote: >>> I have a directory jammed-packed with images. >>> I want to read the directory contents /www/usr/htm/images/ >>> and display randomly any *.gif or *.jpg in said directory. >>> Do-able? Seriously? Ideas? Places to start? > > -- > John Taylor-Johnston > ----------------------------------------------------------------------------- > "If it's not open-source, it's Murphy's Law." > Université de Sherbrooke: > http://compcanlit.ca/ |