#23939 [Opn->Fbk]: strpos is case insensitive when it should not be

From: Date: Sun, 01 Jun 2003 18:49:10 +0000
Subject: #23939 [Opn->Fbk]: strpos is case insensitive when it should not be
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40840@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: Open +Status: Feedback Bug Type: Strings related Operating System: WindowsXP PHP Version: 4.3.2 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#40840) next »