Reputation: 2981
I have a tag in an XML file as "trans-date"
I have loaded the XML file using simpleXML in PHP as
$xml = simplexml_load_file('studentdb.xml');
Now I want to retrieve the value if trans-date field. I have written the code as:
$tdate=$xml->trans-date;
But this line of code is not returning the expected value because "-" is being considered as a minus operator and date as a keyword;
I tried using:
$tdate=$xml->trans."-date";
But this is not working as well. How do I get the value of that field?
Upvotes: 0
Views: 110