how can I count number of occurance of a word in a string while ignoring cases
<p>I am trying to count the number of occurance of a given word while ignoring cases.
I have tried</p>

<pre><code>&lt;?php 
 $string = 'Hello World! EARTh in earth and EARth';//string to look into.
  if(stristr($string, 'eartH')) {
    echo 'Found';// this just show eartH was found.
  }
  $timesfound = substr_count($string, stristr($string, 'eartH'));// this count how many times. 

  echo $timesfound; // this outputs 1 instead of 3.
</code></pre>
