从PHP中的SimpleXMLElement访问值

I have following XML

SimpleXMLElement Object
(
   [active-until] => 2015-03-16T13:45:32Z
   [billing-first-name] => rriiggiidd
   [billing-last-name] => smith
   [created-at] => 2014-03-16T13:45:32Z
   [customer-id] => 50
   [eligible-for-free-trial] => false
   [email] => rigids.php2@gmail.com
   [expired-at] => SimpleXMLElement Object
       (
           [@attributes] => Array
                 (
                     [type] => datetime
                     [nil] => true
                  )

       )
)

I want to fetch value for customer-id and email I am using the code as echo $xml->email;

It is working for me but when i used same for customer-id like echo $xml->customer-id;

It didn't worked(may be because it contains (-))

Can anyone please suggest how to access value if it has hyphen (-).

Any help is really appreciated.

Try as following for the spaces

$object->{'object-property'};

So in your case it will be as

$xml->{'customer-id'};  

etc.