Re: problem with if and exact match

From: Date: Tue, 15 Mar 2011 16:00:01 +0000
Subject: Re: problem with if and exact match
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-311864@lists.php.net to get a copy of this message
On 03/15/2011 07:30 AM, Steve Staples wrote: > > Wouldn't this be better to use, as it is meant to search for the string > inside the string? (use use regex) > > if(stristr($name, 'Jackson')) > { > echo "String is in String"; > } > else > { > echo "Failed"; > } > > http://ca.php.net/manual/en/function.strstr.php (case > sensative) > http://ca.php.net/manual/en/function.stristr.php (case > insensative) > > Steve. > From your link: Note: If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead. -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#311864) next »