I have the following xml to be parsed.
Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => http://schemas.google.com/g/2005#other
[address] => xyz@gmail.com
[primary] => true
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => http://schemas.google.com/g/2005#other
[address] => abc@gmail.com
[primary] => true
)
)
)
I have this above xml and I need to get only adress from this xml.
foreach ($result as $title) {
$email[$count++]=$title->attributes()->address->__toString;
}
debug($email);
The result is this. But I want only address . need some help.
Array
(
[0] => SimpleXMLElement Object
(
)
[1] => SimpleXMLElement Object
(
)
)
see : http://www.php.net/manual/en/simplexmlelement.attributes.php
the solution is to cast the value into string,
for example :
Or iterate the return value will work as well
eg: