php equivalent to asp's instr()

From: Date: Wed, 27 Aug 2003 21:07:34 +0000
Subject: php equivalent to asp's instr()
Groups: php.general 
Request: Send a blank email to php-general+get-160963@lists.php.net to get a copy of this message
Hi. I don't know why but I've had the darndest time trying to find an easy equivalent of asp's InStr() function in PHP. I know there is preg_match(), strpos(), and strstr(), but none of them work like I want them to. In fact, except for maybe preg_match(), I can't get any of them to work right. I want a function that will return true if the string is found, and false if it is not found. Like this:* $needle = "&"; $haystack = "Belle & Sebastian"; if(FoundInString($needle, $haystack)) { echo "found!"; } else { echo "not found!"; } Anyone have a function to share? Thanks, Chris. * Anyone catch the Belle & Sebastian show at the Greek Theatre in LA this past sunday?

« previous php.general (#160963) next »