title: [] operator not supported for strings
body: <p>For this code i get the error.at this line   <code>$sname[] = $rs['StudentId'];</code>
  PHP Fatal error:  [] operator not supported for strings
      $sname = array();
      $i=0;</p>
  
  <pre><code>foreach($data as $rs){
  
      foreach($SchoolName as $sname){
  //      echo $rs['SchoolName'].'=='.$sname."&lt;br /&gt;";
          echo $i."&lt;br /&gt;";                  
          if($rs['SchoolName'] == $sname){
              $sname[] = $rs['StudentId'];
          }   
          $i++;  
      }                   
  }
  </code></pre>