title: How to read youtube data api v3 response in php
body: <p>I have following code:</p>
  
  <pre><code>$yt_profiles = $youtube-&gt;channels-&gt;listChannels('brandingSettings', array(
  'mine' =&gt; 'true',
  ));
  </code></pre>
  
  <p>That returns the following output:</p>
  
  <pre><code>Google_Service_YouTube_ChannelListResponse Object
  (
  [collection_key:protected] =&gt; items
  [etag] =&gt; "WFPuK6TsnblcGPcnMex79s42ynQ/sTnuE1bHO-tokx_mFFDt1ybN90g"
  [eventId] =&gt; 
  [itemsType:protected] =&gt; Google_Service_YouTube_Channel
  [itemsDataType:protected] =&gt; array
  [kind] =&gt; youtube#channelListResponse
  [nextPageToken] =&gt; 
  [pageInfoType:protected] =&gt; Google_Service_YouTube_PageInfo
  [pageInfoDataType:protected] =&gt; 
  [prevPageToken] =&gt; 
  [tokenPaginationType:protected] =&gt; Google_Service_YouTube_TokenPagination
  [tokenPaginationDataType:protected] =&gt; 
  [visitorId] =&gt; 
  [modelData:protected] =&gt; Array
      (
          [pageInfo] =&gt; Array
              (
                  [totalResults] =&gt; 1
                  [resultsPerPage] =&gt; 1
              )
  
          [items] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [kind] =&gt; youtube#channel
                          [etag] =&gt; "WFPuK6TsnblcGPcnMex79s42ynQ/ecOcHFmWyWQ7ToCD7-B1L36b4L4"
                          [id] =&gt; UCQO6uXy5maTpYvSa_yM--Bw
                          [brandingSettings] =&gt; Array
                              (
                                  [channel] =&gt; Array
                                      (
                                          [title] =&gt; Vasim Padhiyar
                                          [showRelatedChannels] =&gt; 1
                                          [featuredChannelsTitle] =&gt; Featured Channels
                                          [featuredChannelsUrls] =&gt; Array
                                              (
                                                  [0] =&gt; UCw-TnDmYDQyjnZ5qpVWUsSA
                                              )
  
                                          [profileColor] =&gt; #000000
                                      )
  
                                  [image] =&gt; Array
                                      (
                                          [bannerImageUrl] =&gt; http://s.ytimg.com/yts/img/channels/c4/default_banner-vfl7DRgTn.png
                                      )
  
                                  [hints] =&gt; Array
                                      (
                                          [0] =&gt; Array
                                              (
                                                  [property] =&gt; channel.featured_tab.template.string
                                                  [value] =&gt; Everything
                                              )
  
                                          [1] =&gt; Array
                                              (
                                                  [property] =&gt; channel.banner.image_height.int
                                                  [value] =&gt; 0
                                              )
  
                                          [2] =&gt; Array
                                              (
                                                  [property] =&gt; channel.modules.show_comments.bool
                                                  [value] =&gt; True
                                              )
  
                                      )
  
                              )
  
                      )
  
              )
  
      )
  
  [processed:protected] =&gt; Array
      (
      )
  </code></pre>
  
  <p>)</p>
  
  <p>I want to loop through modelData:protected variable to get the list of channels and its items data. Its json object so $yt_profiles->modelData:protected not working while accessing. Please help me to solve this issue.
  Thanks in advance</p>