Nieuw lid |
|
Hallo,
Ik heb een functie om de content uit een dir te sorteren op datum.
Nu had ik graag enkel en alleen het bestandsnaamveld als return gehad, dus eigenlijk $content_array[totaalaantalvelden][0].
Hoe kan ik dit bereiken?
TNX!!!!
function lastimages($dir)
{
$content_array = array();
//set current working directory
$dirname = $dir;
//Load Directory Into Array
$handle=opendir($dirname);
$i=0;
while ($file = readdir($handle))
if ($file != "." && $file != ".." && filetype($dirname."/".$file) != "dir" && $file != "Thumbs.db")
{
$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];
if (is_array($sortAux))
array_multisort($sortAux, SORT_DESC, $content_array);
$filenamearray =
if ($i == 0)
return "0";
else
return $content_array;
}
function lastimages($dir) { $content_array = array(); //set current working directory $dirname = $dir; //Load Directory Into Array $i=0; if ($file != "." && $file != ".." && filetype($dirname."/".$file) != "dir" && $file != "Thumbs.db") { $content_array[$i][0] = $file; $content_array[$i][1] = date ("Y m d", filemtime($dirname."/".$file)); $i++; } //close the directory handle //these lines sort the contents of the directory by the date foreach($content_array as $res) $sortAux[] = $res[1]; $filenamearray = if ($i == 0) return "0"; else return $content_array; }
|