title: how to detect str_replace() has done replacement or not? and how many?
body: <p>I have two string, something like this:</p>
  
  <pre><code>$str1='this is the first text';
  $str2='this is the second text';
  </code></pre>
  
  <p>Now I use <code>str_replace();</code> to replace the word of <em>'first'</em> in the <code>str1</code> and <code>str2</code>.</p>
  
  <p>For <code>str1</code>: The subject will be found and then will be replaced</p>
  
  <pre><code>str_replace('first','matched',$str1);
  // output: this is the matched text
  </code></pre>
  
  <p>For <code>str2</code>: The subject will not found and <code>str2</code> does not change.</p>
  
  <pre><code>str_replace('first','matched',$str2);
  // output: this is the second text
  </code></pre>
  
  <p>Now I want to <code>echo</code>:</p>
  
  <ul>
  <li><p><em>'matched has been find'</em> for <code>str1</code> </p></li>
  <li><p><em>'matched has not been find'</em> for <code>str2</code>.</p></li>
  </ul>
  
  <p>And also I want to know that is it possible to count the number of matched found? e.g. for <code>str1</code> is <code>1</code>.</p>