I have the following xml code in my xml:
<features>
<pool type="inground">yes</pool>
<heating type="other"/>
</features>
However, if I do a print_r on my simplexml after parsing the xml, the pool element is set up like a string instead of the heating element which is an object. i.e
[pool] => yes
[heating] => SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => other
)
)
And so the following code to get the type of the pool:
$type = $pool->attributes()->type
fails giving a fatal error -> member method on non object.
What's the solution here?
Thanks in advance.
echo $features->pool['type'];codepad.org/Eu1uMkgI