Code: Select all
$directory = '/path/to/directory/';
if ($handle = opendir($directory)) {
echo "Directory handle: $handle\n";
echo "Files:\n";
//* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
//* Loop through each ad
foreach ($file as $ad); {
$xml = simplexml_load_file("$directory$file");
var_dump($xml);
}
}
}
closedir($handle);
}