Re: strpos error (I'm missing something obvious)

From: Date: Mon, 01 Oct 2007 23:56:16 +0000
Subject: Re: strpos error (I'm missing something obvious)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-262627@lists.php.net to get a copy of this message
jblanchard@pocket.com ("Jay Blanchard") writes: > !== FALSE is not good either, it is not a valid test > > strpos returns the numeric position of the first occurrence of needle in > the haystack string. Except when needle doesn't occur in string, in which case "If needle is not found, strpos() will return boolean FALSE." Checking strpos($foo,$bar) !== False is exactly right; since 0 == False, you want to use !==, not !=. -- Tom Swiss / tms(at)infamous.net / www.infamous.net / www.unreasonable.org "What's so funny about peace, love, and understanding?" - Nick Lowe "Power to the Peaceful" - Michael Franti

« previous php.general (#262627) next »