Lid |
|
Beste,
De code werkt prima, er word correct gesorteerd maar toch krijg ik een foutmelding als volgt:
Citaat: Notice: Use of undefined constant sort_Date - assumed 'sort_Date' in /var/www/vhosts/6/114337/webspace/httpdocs/admin/includes/bestanden-overzicht.php on line 20 Iemand enig idee hoe ik dit kan oplossen? Mijn code:
$directory = '..' . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR;
$open = opendir($directory);
$i = 1;
$files = array();
while($read = readdir($open))
{
if($read != '.' && $read != '..')
{
$files[] = array('name' => $read, 'created' => filemtime($directory.$read));
}
}
function sort_Date($x, $y)
{
return strcasecmp($y['created'], $x['created']);
}
uasort($files, sort_Date);
echo '<table width="100%">';
foreach($files as $key => $value)
{
echo '<tr><td>'.$value['name'].'</td><td>'.date("d-m-Y", $value['created']).'</td></tr>';
}
echo '</table>';
$directory = '..' . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR; $i = 1; { if($read != '.' && $read != '..') { $files[] = array('name' => $read, 'created' => filemtime($directory.$read)); } } function sort_Date($x, $y) { } echo '<table width="100%">'; foreach($files as $key => $value) { echo '<tr><td>'.$value['name'].'</td><td>'.date("d-m-Y", $value['created']).'</td></tr>'; }
|