title: Replace keywords with links to a specific number not to all in php
body: <p>I want to replace a keyword with link in php but problem is that I want to restrict it to two keywords only, if there are more than two number of keywords in string then only two get replaced by link and rest lies as they are. </p>
  
  <pre><code>$string = "hi swimming,  i like to swimming, swimming is fun";
  $keyword = "swimming";
  $link = "http://www.mysite.com";
  </code></pre>
  
  <p>Here I want to replace the first two keywords into link and the third one to be untouched </p>