note 25282 deleted from function.strpos by nlopess
| From: | nlopess@php.net | Date: | Tue, 25 Jul 2006 20:14:57 +0000 |
| Subject: | note 25282 deleted from function.strpos by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-115188@lists.php.net to get a copy of this message | ||
Note Submitter: http://cm.zetyx.net/
----
About issue:
Zero (0) is not a false result; it is a valid answer. The function returns 0 because "abc"
does indeed contain "abc" and the first occurence of the target string starts at position
0.
Use === to test if the function returned true or false.
Try my simple and easy way for use at several PHP version.
$buf = "When doves cry.";
$chk = "Wh";
if (strpos( "#$%".$buf, $chk)) { return TRUE; }
else { return FALSE; }