note 14963 deleted from function.strpos by jimw
| From: | jimw@php.net | Date: | Thu, 18 Oct 2001 21:27:46 +0000 |
| Subject: | note 14963 deleted from function.strpos by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19137@lists.php.net to get a copy of this message | ||
Simplest way is:
$pos = strpos ($str, "b");
if (is_string($pos)
//not found
as whenever it finds, it returns some integer, 0,1,2,... which are NOT string, and when it
doesn't, then return '' which is a string! To place a check !$pos doesn't make
sense as
1) if not found: not of ('') is true, is_string is also true
2) if found, is_string is already false as integer <> string, so parser don't touch !$pos
as there is an AND in between.