title: Fatal error: Allowed memory size exhausted while looping through a 14 element long single-character-array
body: <p>I have a simple string. I need to produce an output Array such that the order of  every 2 consecutive characters is reversed. </p>
  
  <p>Input string is <code>14f05000034e69</code> and I need the following output <code>Array [4, 1, 0, f, 0, 5, 0, 0, 4, 3, 6, e, 9, 6]</code>.</p>
  
  <p>Here is my PHP code:</p>
  
  <pre><code>$myString = "14f05000034e69";
  $myStringArray = str_split($myString);
  
  $newArray = array();
  for ($index=0; $index&lt;count($myStringArray)-1; $index+2) {
      $newArray[] = $myStringArray[$index+1];
      $newArray[] = $myStringArray[$index];
  }
  
  print_r($newArray);
  </code></pre>
  
  <p>And it is giving me</p>
  
  <blockquote>
    <p>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 134217736 bytes) in /var/www/html/test.php on line 8</p>
  </blockquote>
  
  <p>The question is why and how do I fix it?</p>