Count exact substring in a string in php
<p>How can I know the exact number of occurences of a substring in a string. For example consider the following string:</p>

<pre><code>$string = 'The sun is bright, what a beatiful sunlight';
</code></pre>

<p>when I search for the word 'sun' I want it to return 1 instead of 2. That happens when I do:</p>

<pre><code>$counter = substr_count($string, 'sun');
</code></pre>

<p>any idea?</p>
