note 57568 added to function.opendir

From: Date: Fri, 07 Oct 2005 16:56:26 +0000
Subject: note 57568 added to function.opendir
Groups: php.notes 
Request: Send a blank email to php-notes+get-96558@lists.php.net to get a copy of this message
//this is a function I wrote to sort out the contents of the directory date wise for display. $content_array = array(); //set current working directory $dirname = "C:\temp"; //Load Directory Into Array $handle=opendir($dirname); $i=0; while ($file = readdir($handle)) if ($file != "." && $file != "..") { $content_array[$i][0] = $file; $content_array[$i][1] = date ("Y m d", filemtime($dirname."/".$file)); $i++; } //close the directory handle closedir($handle); //these lines sort the contents of the directory by the date foreach($content_array as $res) $sortAux[] = $res[1]; array_multisort($sortAux, SORT_ASC, $content_array); ---- Manual Page -- http://www.php.net/manual/en/function.opendir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57568 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57568&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57568&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57568&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57568&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57568&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57568&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57568&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57568&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#96558) next »