PHP Finding Text in a String
With PHP, you may want to see if text exists in a string. For example, you may have database output from an api and you want to search the rows for particular string. Or, you may want to make conditional statements based on the database output. For example, you may to sort the same 'John' from all other names in a loop. The code below shows two methods for doing so using the preg_match() function and the strpos() function.