title: Access object value in PHP
body: <p>I would like to access the date value from this object in WordPress,
  but I can't get any results.</p>
  
  <pre><code> $dates = $wpdb-&gt;get_results("SELECT DISTINCT YEAR(post_date) FROM wp_posts 
                                ORDER BY post_date");
       foreach($dates as $date){
               echo $date-&gt;YEAR(post_date);
              }
  
  
  
   stdClass Object
      (
          [YEAR(post_date)] =&gt; 2010
      )
      stdClass Object
      (
          [YEAR(post_date)] =&gt; 2011
      )
      stdClass Object
      (
          [YEAR(post_date)] =&gt; 2012
      )
      stdClass Object
      (
          [YEAR(post_date)] =&gt; 2013
      )
  </code></pre>
  
  <p>How can I fix this?</p>