title: how to access stdclass object in php?
body: <p>This is my object:</p>
  
  <pre><code>$reportdata = stdClass Object
  (
      [1] =&gt; stdClass Object
          (
              [reportname] =&gt; reportname1
              [reportviews] =&gt; 20
              [reportpath] =&gt; reports/reportname1
              [thumbnailurl] =&gt; reports/thumbnailurl/thumbnailurl1.jpg
              [description] =&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          )
  
      [2] =&gt; stdClass Object
          (
              [reportname] =&gt; reportname2
              [reportviews] =&gt; 20
              [reportpath] =&gt; reports/reportname2
              [thumbnailurl] =&gt; reports/thumbnailurl/thumbnailurl2.jpg
              [description] =&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          )
  
  
  )
  </code></pre>
  
  <p>I am trying to access the individual values using <code>$reportdata[1]['reportviews']</code> but I get an error </p>
  
  <blockquote>
    <p>"Cannot use object of type stdClass as array".</p>
  </blockquote>
  
  <p>How can I access <code>reportname</code> and <code>reportviews</code>?</p>