This question already has an answer here:
- preg match count matches 5 answers
I have a string like this:
$str = 'this is a string';
And this is my pattern: /i/g
. There is three occurrence (as you see in the string above, it is containing three i
). Now I need to count that. How can I get that number?
</div>