title: preg_replace or str_replace Php Replace by position
body: <p>Let's say I got this string:</p>
  
  <pre><code>$str = "alemylaife";
  </code></pre>
  
  <p>(I know it's misspelled, all my life)</p>
  
  <p>Now how can I replace</p>
  
  <p>"ale" without replacing whatever comes after "ale" that also contains the same letters?</p>
  
  <p>Let's say I got this arrays:</p>
  
  <pre><code>$replace = Array("a","l","e");  
  $with = Array("wh","at","ever");
  
  $str = str_replace($replace,$with,$str);
  echo $str;
  </code></pre>
  
  <p>this will print:</p>
  
  <pre><code> whatevermyatwhifever 
  </code></pre>
  
  <p>How could I stop the str_replace for replacing the letters after "ale"?
  Maybe I got to trim the 3 first letters then replacing them then join the trimmed strings?</p>
  
  <p>EDIT: I'm going to try to express myself clearer.
  I want only the three (3) first letters to be replaced IF they contain A THEN L THEN whateverletter so, ala ale ald alr aly. Those are the letters that I want to be replaced. I don't want letters after them to be affected. </p>