When writing PHP scripts, you often need to search a string for a particular chunk of text. For example, you might be writing a search engine to search through pages of content, or you might want to know if a URL or email address contains a certain domain name.
PHP gives you many useful functions for searching strings. In this article you look at:
strstr()
for finding out whether some text is in a stringstrpos()
andstrrpos()
for finding the position of some text in a stringsubstr_count()
for finding out how many times some text appears in a string