Search found 6 matches

by jasonthomasfrance
Mon Jan 06, 2003 11:19 pm
Forum: PHP coding => General
Topic: View Date Created for each file using PHP Script?
Replies: 1
Views: 930

You have get read all the files in a dir like: <?php $dir='thumbs'; if ($handle = opendir($dir)) { $lasttime=0; $images=array(); while (false !== ($file = readdir($handle))) { if(is_file($file))$images[$file]=filemtime($fi...
by jasonthomasfrance
Mon Jan 06, 2003 11:16 pm
Forum: PHP coding => General
Topic: Array Question (Sorting) - Same but different
Replies: 0
Views: 982

Howdy,

Something like this won't work for you:

arsort($images,SORT_NUMERIC);

That line sorts my array by date (newest to oldest). I would suppose you'd have to get the file info with: if(is_file($file))$images[$file]=filemtime($file);

Does that sound right?
by jasonthomasfrance
Sat Jan 04, 2003 3:42 am
Forum: PHP coding => General
Topic: Array question
Replies: 5
Views: 1706

All righty then. I got it figured out... With some serious help. *grin* You can see it in action here: m There's a couple bugs, but nothing too bad. Here's the code: <?php $dir='thumbs'; if ($handle = opendir($dir)) { $lasttime=0; $images=array(); while (false !== &#...
by jasonthomasfrance
Fri Jan 03, 2003 5:06 am
Forum: PHP coding => General
Topic: Array question
Replies: 5
Views: 1706

How do you mean add 5 to the pointer?
by jasonthomasfrance
Fri Jan 03, 2003 4:57 am
Forum: PHP coding => General
Topic: Array question
Replies: 5
Views: 1706

Okay, using a for loop instead of a while will work...

for($i = 0; $i < 5; $i++) {
list($filenames,$v)=each($images);

But can you pull a range out of an array? Like 5-10?
by jasonthomasfrance
Fri Jan 03, 2003 3:19 am
Forum: PHP coding => General
Topic: Array question
Replies: 5
Views: 1706

Array question

Hello, I'm having some trouble understanding arrays... I've borrowed and rewritten scripting that gets the contents of a folder, sorts by file date, then prints out the contents. I'm having trouble pulling certain information out, like only a certain number of files, and not the entire array. I don'...