title: php - How do I fix this illegal offset type error
body: <p>I'm getting </p>
  
  <blockquote>
    <p>illegal offset type</p>
  </blockquote>
  
  <p>error for every iteration of this code. Here's the code :</p>
  
  <pre><code>$s = array();
  for($i = 0; $i &lt; 20; $i++){
      $source = $xml-&gt;entry[$i]-&gt;source;
      $s[$source] += 1;    
  }
  
  print_r($s)
  </code></pre>