note 451 deleted from function.strpos by jimw
| From: | jimw@php.net | Date: | Thu, 18 Oct 2001 21:23:48 +0000 |
| Subject: | note 451 deleted from function.strpos by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19112@lists.php.net to get a copy of this message | ||
Note that strpos' character index is zero-based; a character match on the first character
returns zero (strpos('ab', 'a') = 0). Thus, a test such as
if (strpos($hay, $needle)) { ... }
can give a false negative. You can use the empty() function or an explicit test (strpos(...) >=
0) to avoid this.