I am working on a php code as shown below in which I want to display modified date and time of all files from a directory(outgoing_folder).
$destination = 'outgoing_folder';
$mp3_files = preg_grep('/^([^.])/', scandir($destination)); /* Line#Z */
print_r($mp3_files); /* Line#X */
Line#X print the following:
Array ([2] => 36017P.mp3 [3] => 36031P.mp3 [4] => hello.mp3)
I have used Line#Z at Line#A and Line#B in order to display the modified date and time of all files from the directory.
<?php foreach ($mp3_files as $file ) : ?> /* Line #A */
<tr>
<td style="width:8%; text-align:center;"> <?php echo basename($file, ".mp3"); ?></td>
<td style="width:8%; text-align:center;"><?php echo date("F d Y",filemtime("$file")); ?></td> /* Line #B */
</tr>
<?php
endforeach;
?>
Line#B display the following o/p (which is not the modified date and time of files):
Date
December 31 1969
December 31 1969
December 31 1969
Problem Statement:
I am wondering what changes I need to make in the php code at Line#B so that I am able to retrieve modified date and time of all the files in a directory.