The code below will show you can use PHP to determine if a text string is contained within a larger text string.
The Code
1 2 3 4 5 6 7 8 9 10 11 |
<?php $larger_string = "The quick brown fox jumped over the lazy dog"; $smaller_string = "fox"; $pos = strpos($larger_string,$smaller_string); if($pos === false) { #not in the string echo "the larger string does not contain 'fox'; } else { #in the string echo "the larger string does contain 'fox'; } ?> |