Search for a string in a variable--- Is there a way to find a particular string in php. For example: I want php to echo "Found" if the word "sports" in found in this url http://yahoo.com/sports/soccer/index.html if not then it should echo "bad Luck" Is there any pre-defined function for this in php? Thanx
$string = "http://yahoo.com/sports/soccer/index.html"; $find = "sports"; if(strpos($string, $find) === false) { echo "Bad Luck"; } else { echo "Found"; } PHP: