// continue for while() loop - not for for() loop! Parameters haystack. Answer: Use the PHP strpos() Function. The PHP provides strpos() function to check if a string contains a specific substring or not. This tutorial provides you three examples to check if a string contains a substring or not. The define() function to set a constant takes three arguments - the key name, the key's value, and a Boolean (true or false) which determines whether the key's name is case-insensitive (false by default). You can also use the PHP’s strpos() function to check whether a string contains a specific word or not. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail: W3Schools is optimized for learning and training. This returns an integer value of the position of the first occurrence of the string. So I wrote this little function: "The quick brown fox jumps over the lazy dog.". The strpos() function finds the position of a string and the stripos() function is the same as the strpos() function but is used for a case-insensitive search. Yeah, there's obvious ways around it, but a native function would be great. There is no case-insensitive variant of this function. Depending on the intended behavior, the Remarks. Note that the needle may be a string of one or more characters. Introduction. more characters. The syntax is almost the same as strpos, e.g. I meet a strange thing with the PHP function strpos(). Note that strpos() is case sensitive,so when doing a case insensitive search,use stripos() instead..If the latter is not available,subject the string to strlower() first,otherwise you may end up in this situation..