filemtime 


php apg

GETS the file modification as a UNIX timestamp.



<?php

int
|false filemtime ( str $filename )


where,

$filename = The path to the file

?>

 $filename 


The path to the file.





This function returns the time when the data blocks of a file were being written to, that is, the time when the content of the file was changed.

Returns FALSE on failure.



  1 EXERCISE   

<?php

$filenm 
= __DIR__ . '/Your Wildest Dreams.m4a';

// The file must exist in the execution path 
// of this script, that is:

echo __DIR__ . '<br><br>';

if (
file_exists($filenm))
{ 
$tmstp = filemtime($filenm);
echo 
'TIMESTAMP = ' . $tmstp . '<br><br>';
echo 
'DATE = ' . date('F d Y H:i:s', $tmstp) . '<br><br>';
}

clearstatcache();

?>

  2 EXERCISE   

<?php

$filenm 
= __FILE__ ;

// Path for this script

echo __FILE__ . '<br><br>';

if (
file_exists($filenm))
{ 
$tmstp = filemtime($filenm);
echo 
'TIMESTAMP = ' . $tmstp . '<br><br>';
echo 
'DATE = ' . date('F d Y H:i:s', $tmstp) . '<br><br>';
}

clearstatcache();

?>