ID:              43824
 User updated by: anon at example dot com
 Reported By:     anon at example dot com
 Status:          Open
 Bug Type:        Feature/Change Request
 PHP Version:     5.2.5
 New Comment:

In case my initial description is confusing, I mean...


Currently you can use strpos, but you have to be careful to test only
with two specific formulations, using the strict equivalency operators:


        if (strpos($x, $y) === FALSE)

or

        if (strpos($x, $y) !== FALSE)


Otherwise you will have ambiguity with a substring position of number
0.


Previous Comments:
------------------------------------------------------------------------

[2008-01-12 00:31:10] anon at example dot com

Description:
------------
What we often need to test for is just whether a substring exists or
not. This is very common, for example, in examining a user agent.

Currently you have to test for these specific formulations, being very
careful to use the strict equivalency operators:

        strpos === FALSE

or

        strpos !== FALSE



It would be handy and much less prone to incorrect syntax use to have a
"string exists" function -- maybe as strex or strpres ("string present")
-- dedicated to this, which returns only TRUE or FALSE.

There could also be a "case sensitive string exists" -- maybe as striex
or stripres.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43824&edit=1

Reply via email to