Python Count Number Of Substrings In String Php