The strstr() function searches for the first occurrence of a string within another string. This function returns the rest of the string (from the matching point). Returns false if the searched string is not found.
Syntax: strstr(string,search)
Parameter string, required. Specifies the string to be searched for.
Parameter search, required. Specifies the string to be searched for. If the argument is a number, searches for characters matching the numeric ASCII value.
This function is case sensitive. For case-insensitive searches, use stristr().
Simple demonstration of strstr() function
Program execution result:
NowaMagic!
Another simple example
Program execution result:
@example.com
This function can be used in many places. If your website has a lot of spam comments, and most of them have links, you need to increase backlinks, so you can use the following tips to eliminate these spam comments with links.
Well, that’s probably it.