its only a part of my text file. it had lot of contents similar to this in this i need to figure out the number of occurance s "newyork,"...in the file
Then what I suggested should work. If it does not, it implies that you are searching for the wrong thing, or not implementing the code properly.
one more string i need to search is "yahoo,"
You have to use substr_count() for "yahoo," separately.
do u need the complete text document to verify.
No. All you need to do is come up with a few sample documents, e.g.,
newyork,
newyork, newyork,
abc newyork, def
newyork, newyork
newyork
abc newyork abc
The first four should have non-zero counts, while the last two should have zero counts.