php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #19874 Case-insensitive strpos()
Submitted: 2002-10-11 20:29 UTC Modified: 2003-01-28 16:06 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: hz11 at nyu dot edu Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.3.0 OS: FreeBSD 4.6.2-RELEASE
Private report: No CVE-ID: None
 [2002-10-11 20:29 UTC] hz11 at nyu dot edu
Maybe I'm missing something, but a case-insensitive strpos() would be handy.  Yeah, there's obvious ways around it, but a native function would be great.

Regards,

Hans

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-28 15:10 UTC] pollita@php.net
Consider using:

  $position = strpos(strtolower($haystack),strtolower($needle));
 [2003-01-28 15:27 UTC] hz11 at nyu dot edu
Yeah, this is the obvious way around it, but it's pretty crude.  I use strpos() for speed, especially on large string, and if you need to first copy the entire string and convert it lowercase, I might as well use stristr().

Implementing stripos() would be so trivial, I can't see a reason not to do it.  I'd do it myself, however, to keep the quality of PHP high, it'd be better for someone with Zend/PHP C experience to write it.

Could stripos() be available in the next minor point release even?

Many thanks,

Hans
 [2003-01-28 15:53 UTC] philip@php.net
worthy argument, may as well leave this feature request open :)  btw, submit a patch and someone will most likely evaluate/comment on it.

new features do not go into minor point releases so if this was implemented it'd go in PHP 5.0.0
 [2003-01-28 15:54 UTC] philip@php.net
hrm, the summary got changed, not sure how.
 [2003-01-28 15:56 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

stripos() function is avaliable in latest HEAD snapshot.
 [2003-01-28 16:06 UTC] hz11 at nyu dot edu
Thank you very much Ilia.  This function will be very useful.

Hans
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC