PHP and SimpleXML - Can't Output File Contents
Thanks in advance for the help...
I'm trying to use SimpleXML to output the contents of one of my files. In order to find the file, I had to scan a directory, split the contents of a folder up into two arrays, and then select the newest file from one of the arrays.
$files = scandir($dir);
$roster = [];
$schedule = [];
foreach ($files as $file) {
if (!(strpos($file, 'roster')===false)) {
$roster<< $file;
} else {
$schedule<< $file;
}
}
Now when I try to use SimpleXML, I can't get anything to show up.
$xml_file = $file;
$xml = simplexml_load_file($xml_file);
(At this point I try to output the information using echo, but no luck.)
Do I need to open and close the file, or is there another crucial step I'm missing?