note 83243 added to tutorial.useful
| From: | gz at example dot com | Date: | Fri, 16 May 2008 12:33:34 +0000 |
| Subject: | note 83243 added to tutorial.useful | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139444@lists.php.net to get a copy of this message | ||
tomcraig:
If the search string is in the first position (i.e. position[0]), then your coditional will resolve
to false.
anonymous:
"The function should return TRUE on any non-zero value." The strpos() function never
returns true. It returns, as daniel says, either false or an integer. That includes 0, which
evaluates to false if using "==". Also note that the manual text (as you yourself quote
it) says that, in the case of an unsuccessful search, the if expression evaluates to true, not that
the strpos() function returns true (which, again, it never does).
Mark:
"Try it with == TRUE. It works fine..." Sure it does, as long as the search string is not
in the first position.
The manual and daniel are correct.
----
Server IP: 69.147.83.197
Probable Submitter: 12.219.103.213
----
Manual Page -- http://www.php.net/manual/en/tutorial.useful.php
Edit -- https://master.php.net/note/edit/83243
Del: integrated -- https://master.php.net/note/delete/83243/integrated
Del: useless -- https://master.php.net/note/delete/83243/useless
Del: bad code -- https://master.php.net/note/delete/83243/bad+code
Del: spam -- https://master.php.net/note/delete/83243/spam
Del: non-english -- https://master.php.net/note/delete/83243/non-english
Del: in docs -- https://master.php.net/note/delete/83243/in+docs
Del: other reasons-- https://master.php.net/note/delete/83243
Reject -- https://master.php.net/note/reject/83243
Search -- https://master.php.net/manage/user-notes.php