title: PHP: array chunk where each chunk is not more than a fixed memory size
body: <p>I have an array</p>
  <pre><code>$profileIds = [1, 2, 3, 4, 5, 6, 7, .............., 8000];
  </code></pre>
  <p>I want to get the minimum number of array chunks like <code>[1,2,3], [4,5,6,7,8], [9, 10, 11, 12]</code> where each chunk size is not more than fixed memory size i.e. 200KB. Thanks in advance.</p>
  <p>I am getting the size of the array in bytes by doing:</p>
  <pre><code>$bytes = mb_strlen(serialize($array), '8bit');
  </code></pre>