<?php
function cmp($a, $b) {
if (filemtime($a) == filemtime($b))
return 0;
return (filemtime($a) < filemtime($b)) ? -1 : 1;
}
$files = glob("/Users/xx/Desktop/2011/cdr/*.cdr");
usort($files, "cmp");
foreach($files as $file)
//echo $file . "<br />";
// echo "$file was last modified: " . date ("d-m-Y H:i:s.", filemtime($file))."
";
$file1 = file_get_contents($file, FILE_USE_INCLUDE_PATH);
$arr1 = explode("
", $file1);
$data1 = array();
foreach ($arr1 as $key => $value) {
$split = explode(";", $value);
$keys = md5(uniqid(rand(), true));
}
print_r($data1);
?>
I am trying to get contents from each file but it keep getting below
Array ( )
Question is how can i fix the error when am trying to get contents from each individual file in a folder? Should i make a loop to read from each file separately ?