note 105218 added to function.strpos
| From: | mind at osu1 dot php dot net | Date: | Wed, 03 Aug 2011 13:08:03 +0000 |
| Subject: | note 105218 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182138@lists.php.net to get a copy of this message | ||
To support at tothepointsolution dot com.
Did you even test your own example? The result, at least on my computer is
int(9)
int(0)
int(1)
which is absolutely correct, considering the fact, that arrays in php are zero based.
Are you sure your second example returns boolean FALSE instead of integer zero? Check it with
<?php
if (strpos('-1','-')===FALSE) {
echo 'Something is terribly wrong';
} elseif (strpos('-1', '-')===0) {
echo 'OK';
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 213.180.98.21
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- https://master.php.net/note/edit/105218
Del: integrated -- https://master.php.net/note/delete/105218/integrated
Del: useless -- https://master.php.net/note/delete/105218/useless
Del: bad code -- https://master.php.net/note/delete/105218/bad+code
Del: spam -- https://master.php.net/note/delete/105218/spam
Del: non-english -- https://master.php.net/note/delete/105218/non-english
Del: in docs -- https://master.php.net/note/delete/105218/in+docs
Del: other reasons-- https://master.php.net/note/delete/105218
Reject -- https://master.php.net/note/reject/105218
Search -- https://master.php.net/manage/user-notes.php