#23939 [Csd->Bgs]: strpos is case insensitive when it should not be
| From: | philip@php.net | Date: | Sun, 01 Jun 2003 18:56:57 +0000 |
| Subject: | #23939 [Csd->Bgs]: strpos is case insensitive when it should not be | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40842@lists.php.net to get a copy of this message | ||
ID: 23939
Updated by: philip@php.net
Reported By: tony at marston-home dot demon dot co dot uk
-Status: Closed
+Status: Bogus
Bug Type: Strings related
Operating System: WindowsXP
PHP Version: 4.3.2
New Comment:
status->bogus
Previous Comments:
------------------------------------------------------------------------
[2003-06-01 13:54:05] tony at marston-home dot demon dot co dot uk
Ignore this - I found my mistake.
------------------------------------------------------------------------
[2003-06-01 13:49:09] philip@php.net
I cannot confirm this:
<?php
$h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
$p1 = strpos($h, 's');
$p2 = stripos($h, 's');
echo "strpos position $p1 gives me " . $h{$p1};
echo "\n";
echo "stripos position $p2 gives me " . $h{$p2};
?>
Outputs:
strpos position 44 gives me s
stripos position 18 gives me S
Can you double check?
Tested: Linux, PHP 4.3.2 / 5.0.0
------------------------------------------------------------------------
[2003-06-01 13:31:33] tony at marston-home dot demon dot co dot uk
$haystack contains
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
so why does $pos = strpos($haystack, 's'); return me the position of
'S' instead of 's'?
If I wanted a case insensitive search I would use stripos instead.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23939&edit=1