0

I am trying to loop within object array in php, I am trying to learn how to loop within the object array by trying different code but none of them work, below is the structure of array that I am trying to display the content of the object array.

stdClass Object
(
    [status] => true
    [feeds] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 007
                    [title] => Politics Politics Politics
                    [image] => www.test.com/jpg
                    [artwork] => www.test.com/jpg
                    [lastUpdateTime] => 1631257343
                    [lastCrawlTime] => 1631280190
                    [lastParseTime] => 1631257353
                    [lastGoodHttpStatusTime] => 1631280190
                    [lastHttpStatus] => 200
                    [contentType] => text/xml; charset=UTF-8
                    [itunesId] => 1051566354
                    [language] => en-us
                    [type] => 0
                    [dead] => 0
                    [crawlErrors] => 0
                    [parseErrors] => 0
                    [categories] => stdClass Object
                        (
                            [55] => News
                            [59] => Politics
                        )

                    [locked] => 1
                    [imageUrlHash] => 1638302455
                )

Below is the code I am using to loop within the array

foreach ($results as $res) {
   echo $res->title;
}
Abbasi
  • 588
  • 1
  • 7
  • 23

0 Answers0