title: Multidimensional Array Sum Column
body: <p>I have a multidimensional array with a <strong>race type</strong> column and a <strong>boats</strong> column (which has the total number of boats for each race type). This is how I am getting the array values:</p>
  
  <pre><code>$boats = $wpdb-&gt;get_results("
          select rt.race_type
                ,sum(tr.boat_count) boats
            from registrations tr
           group by rt.race_type;
  ");
  </code></pre>
  
  <p>The array works perfectly fine. But now I am trying to get the total number of boats for all race types (without using a loop). After some research, I have tried the code below, but it doesn't seem to be working:</p>
  
  <pre><code>$totalboats = array_sum(array_column($boats,'boats'));
  </code></pre>
  
  <p>When I run the following command:</p>
  
  <pre><code>echo $totalboats;
  </code></pre>
  
  <p>The result of that is 0, which is clearly wrong.</p>
  
  <p>Any ideas? I am running PHP 5.6.29.</p>
  
  <p><strong><em>================== EDIT 01 ==================</em></strong></p>
  
  <p>As requested, here is the <strong>var_dump</strong> of <strong>$boats</strong>:</p>
  
  <pre><code>array(2) {
      [0]=&gt;
          object(stdClass)#672 (2) {
              ["race_type"]=&gt; string(12) "Elite 8-Hour"
              ["boats"]=&gt; string(1) "2"
          }
      [1]=&gt;
          object(stdClass)#673 (2) {
              ["race_type"]=&gt; string(12) "Sport 4-Hour"
              ["boats"]=&gt; string(1) "2"
          }
  }
  </code></pre>