On Wed, 2008-06-04 at 10:18 -0600, Nathan Nobbe wrote:
> On Wed, Jun 4, 2008 at 10:10 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> >
> >  and the case insensitive versions are a hair faster still ;)
> >>
> >
> > Are they? I always thought that case-sensitive functions were faster
> > because they have to test fewer comparisons. Eg To test if i == I in a
> > case-insensitive fashion requires two comparisons (i == I and i == i)
> > whereas a case-sensitive comparison requires only one (i == i).
> 
> 
> umm, isnt it like the other way around.  in the case of case-sensitive, you
> have to be able to distinguish between i and I, whereas w/ the case
> insensitive, you dont care so, basically, you strtolower() first thing, then
> just compare to lower case characters.

Nope, case insensitive is slower since you must make two tests for
characters having a lower and upper case version. With case sensitive
comparisons you only need to make a single comparison.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to