Hi there,
I am somewhat new to PHP but catching on fairly well. However, I'm currently stumped.
I would like to access the newest XML file in a folder. Right now my code is hardwired so everytime I want to see the newest file I have to actually enter it into the PHP code. I know there is a way to get it to read the newest file, but I can't figure it out for the life of me.
The code I'm using is (I've bolded the part I need to apply the query to):
<?php
// set name of XML file
$file = "xml_files/article_01.xml";
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
// access XML data
echo nl2br(" " . $xml->headline . "\n");
echo nl2br(" " . $xml->byline . "\n");
echo nl2br(" " . $xml->author . "\n\n");
echo nl2br(" " . $xml->article . "\n");
?>