I keep having an issue where one of my variables, $xml, keeps being mistaken for a boolean when it should be returning an object.
I've tried changing $xml to $data... thinking maybe it was a naming issue.
I have also tried isolating the str() function but that is being recognized as string - which is correct.
I have also tried using gettype(simplexml_load_string(str()); which returns a bool as well.
Please let me know what I might be doing wrong:
function str() {
if(file_exists(__DIR__ . '/../' . $clientXML)) {
return file_get_contents(__DIR__ . '/../' . $clientXML);
} else {
return file_get_contents(__DIR__ . '/../xml-skeleton.xml');
}
}
$xml = simplexml_load_string(str());
echo 'XML IS: ' . gettype($xml);