ID: 43825 Updated by: [EMAIL PROTECTED] Reported By: anon at example dot com -Status: Open +Status: Bogus Bug Type: Feature/Change Request PHP Version: 5.2.5 New Comment:
. Previous Comments: ------------------------------------------------------------------------ [2008-01-12 01:10:18] anon at example dot com Description: ------------ What we often need to test for is just whether a substring exists or not. For example this is very common in examining a user agent. 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) That "anti-FALSE" approach is generally awkward, and if you use == or != by mistake you'll have ambiguity with a substring position of number 0. It would be handy and much less prone to syntax mistakes, to have a dedicated "string exists" function which returns only TRUE or FALSE. This might be "strex" or "strpres" ("string present"). Plus an equivalent case sensitive version -- striex or stripres. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43825&edit=1