Question

I want my array to be two dimensional. My code is :

$tabelka=glob('music/*');
$tabelkaa=natsort($tabelka);


foreach ($tabelka as $filename) {


     $list .= '<td>' . filesize($filename) . '</td><td>' . date ("F d Y H:i:s.", filemtime($filename)) . '</td>'.PHP_EOL;


     }

    echo ($list);

This code is on external device (rapsberry pi) and is used on server with 'file()' command. To achieve what i want a two dimensional array is needed. One dimension of this array needs to be filesize and the second would be filemtime.

Was it helpful?

Solution

$data = array();
foreach($tabelka as $filename) {
   $data[$filename] = array('mtime' => filemtime($filename), 'size' => filesize($filename));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top