title: PHP string direct access using str[index] vs splitting into an array
body: <p>I'm iterating through each character in a string in PHP.
  Currently I'm using direct access</p>
  
  <pre><code> $len=strlen($str);
   $i=0;
   while($i++&lt;$len){
      $char=$str[$i];
      ....
   }
  </code></pre>
  
  <p>That got me pondering what is probably purely academic.
  How does direct access work under the hood and is there a length of string that would see optimization in a character loop(micro though it may be) by splitting said string into an array and using the array's internal pointer to keep index location in memory?</p>
  
  <p><strong>TLDNR:</strong>
  Would accessing each member of a 5 million item array be faster than accessing each character of a 5 million character string directly?</p>