Reputation: 1
in my xml file there is field like this:
<state-code>GA</state-code>
now i am fetching data from it in php. simplexml_load_file is returning the whole content as object. no problem still now ,but when i am writing like this
$single_property->location->state-code
it is not fetching value. but if it is or then no problem.but i don't have control over the xml file structure.have to find out another way. what to do?please suggest.
Upvotes: 0
Views: 81
Reputation: 79024
Assuming all other code not shown is correct, you access a property with illegal chars (the -) like:
$single_property->location->{'state-code'}
Upvotes: 1