August 2nd, 2000, 07:14 AM
how do i count the number of hits when i search a file with the function strstr?
August 2nd, 2000, 02:20 PM
So, your trying to count the number of times a string occurs in a string. I needed to do this a while ago.
I got it to work by looping around until every instance as found. This wasnt very good though.
The bets way Ive used is to explode the string by the string and subtract one.
$count = explode ($string1, $string2);
Hope this helps
"If Builders Built Buildings the way programmers programmed programs, the first woodpecker that came along would destroy civilisation"