title: split string of 8 characters in for loop in php
body: <p>I have strings (checked with gettype) from 8 characters like this:</p>
  
  <pre><code>47780000
  79110000
  96040000
  49321200
  </code></pre>
  
  <p>My goal is to split each string in 4 parts, and each part should have length of 2 characters</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    foreach($klist as $k){
          echo $kad ."&lt;br /&gt;";
          $part1 = trim(substr($k,0,2));
          echo $part1 ."&lt;br /&gt;";
          $part2 = trim(substr($k,2,2));
          echo $part2 ."&lt;br /&gt;";
          $part3 = trim(substr($k,4,2));
          echo $part3 ."&lt;br /&gt;";
          $part4 = trim(substr($k,6,2));
          echo $part4 ."&lt;br /&gt;";
      }
  </code></pre>
  
  <p>Here is the output that I get:</p>
  
  <pre><code>47780000
  47
  78
  00
  00
  // above output is correct and as I want it to be
  
  // however, the results bellow are wrong, there is one character missing
  
  79110000
  7
  91
  10
  00
  
  96040000
  9
  60
  40
  00
  
  49321200
  4
  93
  21
  20
  </code></pre>
  
  <p>Can anyone help me with this code and explain to me why I have one character less in each result after the first result?</p>