title: Got strange result on php array excel upload
body: <p>guys! I need some help of my code,why are my array result on excel upload is get a null value? I'm trace the code and debug it but still got nothing. </p>
  
  <p>Here's my excel data:</p>
  
  <pre><code>Title   
  =======================================================================================================
  |Region |Branch Id  | Agent Code    | Cabang |  Policy No   | Policy Holder     | Remark |Date        |
  =======================================================================================================
  |NYC    |           |   12345       | BG 3   |  3003659123  | YU KERY           | Remark | 15-05-2017 |
  |JKT    |           |   54321       | BG 3   |  3003822124  | PRAWINDRA IRAWAN  | Remark | 30-12-2016 |
  =======================================================================================================
  </code></pre>
  
  <p>I just want get the data start from agent code,but after debug the there null array data and also got strange date too.</p>
  
  <pre><code>                [0] =&gt; Array
                      (
                          [0] =&gt; 12345
                          [1] =&gt; NYC
                          [2] =&gt; 3003659123 
                          [3] =&gt; YU KERY
                          [4] =&gt; Remark
                          [5] =&gt; 42870 ?
                          [6] =&gt; ???
                      )
  </code></pre>
  
  <p>Here's my code to get the excel data:</p>
  
  <pre><code>        for ($h = 0; $h &lt;= PHPExcel_Cell::columnIndexFromString($objPHPExcel-&gt;getActiveSheet()-&gt;getHighestColumn()); $h++)
              if(trim($objPHPExcel-&gt;getActiveSheet()-&gt;getCellByColumnAndRow($h,2)-&gt;getValue()))
                  $headerText['sheet0'][] = strtoupper($objPHPExcel-&gt;getActiveSheet()-&gt;getCellByColumnAndRow($h,2)-&gt;getValue()); // get header or field name
  
          $startRow = 3;  
          for ($i = $startRow; $i &lt;= $objPHPExcel-&gt;getActiveSheet()-&gt;getHighestRow(); $i++) 
          {
              $dataRow = array();
              for ($j = 2; $j &lt;= count($headerText['sheet0']); $j++) 
              {
                  $region = strtolower($objPHPExcel-&gt;getActiveSheet()-&gt;getCellByColumnAndRow(0,$i)-&gt;getValue());
                  $branch = strtolower($objPHPExcel-&gt;getActiveSheet()-&gt;getCellByColumnAndRow(1,$i)-&gt;getValue());
  
                  if ($region != null) {
                      $dataRow[] = $objPHPExcel-&gt;getActiveSheet()-&gt;getCellByColumnAndRow($j,$i)-&gt;getValue();
                      if(!in_array($region,$arrNPK) &amp;&amp; !empty($region))
                      $arrNPK[] = $region;
  
                  } elseif ($region == null &amp;&amp; $branch != null) {
  
                      $dataRow[] = $objPHPExcel-&gt;getActiveSheet()-&gt;getCellByColumnAndRow($j,$i)-&gt;getValue();
                      if(!in_array($branch,$arrNPK) &amp;&amp; !empty($branch))
                      $arrNPK[] = $branch;
  
                  }
              }
              $arrResult['sheet0'][$region][] = $dataRow;
              $arrResult['sheet0'][$branch][] = $dataRow;
              print_r($arrResult);exit();
          }
  </code></pre>
  
  <p>why i made $region and $branch is because sometimes users,only fill one of them in excel. </p>