php - How do I fix this illegal offset type error
        Posted  
        
            by Steven
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Steven
        
        
        
        Published on 2010-04-28T19:15:25Z
        Indexed on 
            2010/04/28
            19:27 UTC
        
        
        Read the original article
        Hit count: 257
        
I'm getting "illegal offset type" error for every iteration of this code. Here's the code in case anyone can help:
$s = array();
for($i=0;$i<20;$i++){
    $source = $xml->entry[$i]->source;
    $s[$source] += 1;
}
print_r($s)
Any ideas. Thanks in advance.
© Stack Overflow or respective owner