<?php
function Afilemtime( $files ) {
$return = array();
if (TRUE === is_array($files)) {
foreach ($files as $file) {
if (FALSE === file_exists($file)) continue;
$return[$file] = filemtime($file);
}
} else {
$return[$files] = filemtime($files);
}
return $return;
}
$arrayOfFiles = array(
'phpinfo.php',
'inconnu.php', // Fichier inexistant
'perrow.php',
'hostname.php'
);
print_r( Afilemtime($arrayOfFiles) );
$string = 'hostname.php';
print_r( Afilemtime($string) );
?>
Résultats:
Code : Tout sélectionner
Array
(
[phpinfo.php] => 1120952348
[perrow.php] => 1124073265
[hostname.php] => 1124068339
)
Array
(
[hostname.php] => 1124068339
)