note 125535 added to function.strpos
| From: | sunmacet at gmail dot com | Date: | Mon, 23 Nov 2020 10:14:30 +0000 |
| Subject: | note 125535 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215886@lists.php.net to get a copy of this message | ||
To check that a substring is present.
Confusing check if position is not false:
if ( strpos ( $haystack , $needle ) !== FALSE )
Logical check if there is position:
if ( is_int ( strpos ( $haystack , $needle ) ) )
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.174 (proxied: 2a01:cb19:904:1800:64d9:bd3:7302:f2a1)
----
Manual Page -- http://php.net/manual/en/function.strpos.php
Edit -- https://master.php.net/note/edit/125535
Del: integrated -- https://master.php.net/note/delete/125535/integrated
Del: useless -- https://master.php.net/note/delete/125535/useless
Del: bad code -- https://master.php.net/note/delete/125535/bad+code
Del: spam -- https://master.php.net/note/delete/125535/spam
Del: non-english -- https://master.php.net/note/delete/125535/non-english
Del: in docs -- https://master.php.net/note/delete/125535/in+docs
Del: other reasons-- https://master.php.net/note/delete/125535
Reject -- https://master.php.net/note/reject/125535
Search -- https://master.php.net/manage/user-notes.php