Quantcast
Channel: Looping through a SimpleXML with foreach in php - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Looping through a SimpleXML with foreach in php

$
0
0

I'm trying to get the array values into the next SimpleXMLElement Object to get the [property] values, but I am not sure what is the best way to loop this object with an foreach in PHP,

Object code that I am getting:

SimpleXMLElement Object(    [nowplaying-info] => Array        (            [0] => SimpleXMLElement Object                (                    [@attributes] => Array                        (                            [mountName] => KDLDFMAAC                            [timestamp] => 1621880102                            [type] => track                        )                    [property] => Array                        (                            [0] => 248000                            [1] => 1621880102606                            [2] =>    LOS ANGELES AZULES FT PEPE AGILAR                            [3] => 97008                            [4] => NI CONTIGO NI SIN TI                        )                )            [1] => SimpleXMLElement Object                (                    [@attributes] => Array                        (                            [mountName] => KDLDFMAAC                            [timestamp] => 1621879804                            [type] => track                        )                    [property] => Array                        (                            [0] => 185000                            [1] => 1621879804060                            [2] => FITO OLIVARES                            [3] => 97754                            [4] => JUANA LA CUBANA                        )                )            [2] => SimpleXMLElement Object                (                    [@attributes] => Array                        (                            [mountName] => KDLDFMAAC                            [timestamp] => 1621879192                            [type] => track                        )                    [property] => Array                        (                            [0] => 252000                            [1] => 1621879192436                            [2] =>    CHON ARAUZA                            [3] => 97076                            [4] => UN MONTON DE ESTRELLAS                        )                )        ))

Could you please help with the best way to looping inside this object?

Thanks!


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>