In the below code I'm trying to access @attributes
of Userinfo
as $somevariable->Userinfo->attributes();
which is perfectly fine, but when there is no @attributes
it throws an error
Call to a member function attributes() on null
[Userinfo] => SimpleXMLElement Object
(
[@attributes] => Array
(
[UserId] => 121
[UserName] => Arun, Singh
[UserEmail] => abc@xyz.com
[CreatedDate] => 06/27/2018 08:44:21
)
)
So, before accessing @attributes
, how to check if it exist ?
Thank you.