Re: When is "z" != "z" ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2006-06-05 at 12:49, tedd wrote:
> -TG:
> 
> Thanks for your explanation and time.
> 
> Normally, I don't alpha++ anything -- not to criticize others, but to me it doesn't make much sense to add a number to a character.  But considering the php language is so string aware, as compared to other languages, I just tried it on a lark just to see what would happen.
> 
> Okay, so I found out it's limitations and quirks.
> 
> But, you must admit that it is confusing to have a loop that goes from "a" to "z" and considers "aa" but not "aaa".
> 
> Now, if the loop just went from a to z, then I would think that would be logical. But I fail to see the logic behind considering "aa" but not "aaa" in the evaluation. But then again, I'm not that informed.
> 
> Enough said.

NOOOOO! More must be said!!

a   <= z
b   <= z
c   <= z
...
y   <= z
z   <= z
aa  <= z
ab  <= z
ac  <= z
...
az  <= z
ba  <= z
bb  <= z
bc  <= z
...
cz  <= z
...
dz  <= z
...
...
...
yx  <= z
yy  <= z
yz  <= z
za   > z

SOOOOOOOOOOOOOOOOooooooooooo, the comparisons stop before we get to aaa
and so aaa is never reached. za is the last comparison to occur at which
point the test fails and the loop stops.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux