Re: Re: Bug #1323 Updated: strpos and 0th indexed strings

From: Date: Sun, 18 Apr 1999 14:09:57 +0000
Subject: Re: Re: Bug #1323 Updated: strpos and 0th indexed strings
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-5117@lists.php.net to get a copy of this message
> How do "check it correctly"? How do I tell that the "needle" was not found > versus the "needle" was found > at the beginning of the "haystack"? There are many ways: if( (string)strpos("abc","a")!="" ) or if( strlen(strpos("abc","a")) ) You just have to consider the fact that strpos() returns a 0-length string when it doesn't find anything and it returns an integer of 0 when it finds it in the first position. Just doing if(strpos()) is therefore not sufficient for this function. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5117) next »