I have an array that contains @sign in the object. I can’t access that
Actually I’m parsing XML into array
The print_r output is below
[link] => SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => text/html
[href] => http://www.livingsocial.com/cities/1964-klang-valley-kuala-lumpur/deals/393950-2-pax-steamboat-set-2-iced-lemon-tea
[rel] => alternate
)
)
$entry->link->@attributes->href
Can’t access
You have to use the attributes() method to get attributes from a SimpleXMLElement object
If you want to get the href attribute as string you can do the following: