#13730 [Opn->Csd]: StrPos is deficient
| From: | andrey@php.net | Date: | Sat, 18 Jan 2003 18:49:34 +0000 |
| Subject: | #13730 [Opn->Csd]: StrPos is deficient | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30498@lists.php.net to get a copy of this message | ||
ID: 13730
Updated by: andrey@php.net
Reported By: anthony@syntell.net
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: Linux/Red Hat 7.1
PHP Version: 4.0.6
New Comment:
Even though PHP is loosed type language there is === operator for
checking the types as well the values. If the developer is lazy to
write !== FALSE then he/she can get the flames after that because
he/she deserves them. This will break BC and won't be implemented.
Regarding the "one based" string position. PHP is like C, not Pascal.
Previous Comments:
------------------------------------------------------------------------
[2002-02-19 14:18:24] dadarden@iti2.net
Or make the string position one based instead of zero based so that a
return of 0 can be used for false and any other return is true.
strstr() can usually be used that way, but seems to get confused
looking for "/".
------------------------------------------------------------------------
[2001-10-18 05:42:03] anthony@syntell.net
re StrPOS, I suggest that you do the following.
Make another function with a different name, e.g. StrFind, that is
1) less problematic in distinguishing between found at pos zero and not
found. e.g. return -1 for not found.
2) case-insensitive, or (better) has an optional parameter
($casesensitive = false) that defaults to false
You could also roll in last-occurence functionality a la strrpos with
option flags
After this, mark the StrPos function as obsolete/deprecated.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=13730&edit=1