title: PHP preg_match_all and str_replace
body: <p>i have a little problem about preg_match_all and str_replace</p>
  
  <pre><code>&lt;?
      $source = 'hello @user_name, hello @user_name2, hello @user_name3';
      preg_match_all("/@[\w\d_]*/s", $source, $search);
      foreach($search[0] as $result) {
          $source = str_replace($result, "&lt;b&gt;okay&lt;/b&gt;", $source);
      }
  
      echo $source;
  ?&gt;
  </code></pre>
  
  <p>the result is (wrong):</p>
  
  <pre><code>hello &lt;b&gt;okay&lt;/b&gt;, hello &lt;b&gt;okay&lt;/b&gt;2, hello &lt;b&gt;okay&lt;/b&gt;3
  </code></pre>
  
  <p>the right result should be like this:</p>
  
  <pre><code>hello &lt;b&gt;okay&lt;/b&gt;, hello &lt;b&gt;okay&lt;/b&gt;, hello &lt;b&gt;okay&lt;/b&gt;
  </code></pre>
  
  <p>anyone can help?
  Thanks!</p>