title: How do i str_split text character according to multiple record in query
body: <p>I have example 2,1,3,2 record for the query <code>$qty</code> in my solution i want to split each 4 diffrent characters from the text line of <strong>1234567810111213141516171819202122232425262728</strong> just  according to each record in <code>$qty</code> in achievement my expected output should look like 1234,5678,9101,1121,3141,5161,7181,9202
  i have tried:</p>
  
  <pre><code>&lt;?php
  require("init.php");
  ?&gt;
  &lt;?php
  $sql = mysqli_query($conn, "select * from books where book='1644445'");
  while($row = mysqli_fetch_assoc($sql))
  {
  $qty  = $row["quantity"];  
  echo "&lt;br/&gt;$qty"; #result 2132
  $plit = "1234567810111213141516171819202122232425262728";
  $show_plit = str_split($plit, 4);
  for($b = 0; $b&lt;$qty; $b++)
  {
  echo "&lt;br/&gt;$show_plit[$b]";
  }
  }
  ?&gt;
  </code></pre>
  
  <p>but i get 1234,5678,1234,1234,5678,9101,1234,5678 in output what are mine doing wrong.
  Big thanks in advances</p>