Looping through a SimpleXML object

Posted by Aditya on Stack Overflow See other posts from Stack Overflow or by Aditya
Published on 2010-05-24T21:26:57Z Indexed on 2010/05/24 21:31 UTC
Read the original article Hit count: 170

Filed under:

I have a simpleXml object and want to read the data from the object , I am new to PHP and dont quite know how to do this. The object details are as follows.

I need to read [description] and [hours]. Thankyou.

SimpleXMLElement Object ( [@attributes] => Array ( [type] => array ) [time-entry] => Array ( [0] => SimpleXMLElement Object ( [date] => 2010-01-26 [description] => TCDM1 data management: sort & upload NFP SubProducers list [hours] => 1.0 [id] => 21753865 [person-id] => 350501 [project-id] => 4287373 [todo-item-id] => SimpleXMLElement Object ( [@attributes] => Array ( [type] => integer [nil] => true ) ) ) [1] => SimpleXMLElement Object ( [date] => 2010-01-27 [description] => PDCH1: HTML [hours] => 0.25 [id] => 21782012 [person-id] => 1828493 [project-id] => 4249185 [todo-item-id] => SimpleXMLElement Object ( [@attributes] => Array ( [type] => integer [nil] => true ) ) ).

Please help me. I tries a lot of stuff , but not getting the syntax right.

© Stack Overflow or respective owner

Related posts about simplexml