Create Function in PHP to Count Words in a String By WebRewrite | August 8, 2014 - 5:11 pm |August 8, 2014 PHP Leave a comment One person has asked me to write a function in PHP to count number of words in a string. You don’t have to use any inbuilt function in PHP except strlen and strpos. →