I have an XML file which I have used xpath to extract the last Element.
So at the moment this line of code below:
//Get The file from directory
$xml=simplexml_load_file("docs/03-24-2014.xml");
//Get last Element
$last = $xml->xpath("/DocumentElement/Datas[last()]");
Output
array(1) { [0]=> object(SimpleXMLElement)#4 (6) { ["Name"]=> string(12) "COM3-Screen1" ["AdjustMode"]=> string(10) "AutoAdjust" ["Time"]=> string(19) "03-24-2014 11:59:27" ["ScreenBrightnessValues_x0028_0-255_x0029_"]=> string(1) "2" ["AmbientBrightness_x0028_lux_x0029_"]=> string(1) "0" ["BrightnessPercentage"]=> string(2) "0%" } }
Goal
What am trying to achieve is extract the last data tag called "BrightnessPercentage and store it in a string"
I tried echo $last->BrightnessPercentage .;
but it didnt work!
Any help you be kindly appreciated