Good day to you,
I have an multi-dimensional array and I need to sort it by date and then height.
My question is how would I build my code to do such a function ?
Here is how I have built my array :
[code=php]
<?php
$imgdir= $_GET[‘folder’];
$imgdir.=”/”;
function dircont($imgdir)
{
$dir_array = array();
if (false !== ($dir = opendir($imgdir)))
{
while (false !== ($file = readdir($dir)))
{
if ($file != ‘.’ && $file != ‘..’)
{
$fInfo = array();
$fInfo[] = $file;
if (($imageInfo = @getImageSize($imgdir.””.$file)) !== false)
{
$fInfo[‘width’] = $imageInfo[0];
$fInfo[‘height’] = $imageInfo[1];
}
if (($stat = stat($imgdir.””.$file)) !== false)
{
$fInfo[‘mtime’] = $stat[‘mtime’];
// Lol, forgot to put the size in 😛
$fInfo[‘size’] = $stat[‘size’];
}
$dir_array[] = $fInfo;
}
}
return $dir_array;
}
else
{
return false;
}
}
// To print..
echo “<pre>”;
print_r(dircont($imgdir));
echo “</pre>”;
?>