On Monday 05 June 2006 14:56, Martin Alterisio wrote:
> 2006/6/5, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> > This is just one of those cases where the designers had to make a
> > judgement call on how things were going to operate.  It makes sense if
> > you look at the two things separately (incrementing vs string 'greatness'
> > evaluation) and makes sense that how they chose to implement the
> > functions are two valid choices among many ways that it could have been
> > handled.
>
> How does it make sense? I don't understand your argument, can you explain
> it a little bit more?

See Robert Cummings' post.  < and > are being interpreted in this case for 
alphabetical order.  Read "<" as "alphabetically before", and <= 
as "alphabetically before or string-equal to".

Is a alphabetically before or string-equal to z?  TRUE.
Is b alphabetically before or string-equal to z?  TRUE.
...
Is z alphabetically before or string-equal to z?  TRUE. (string-equal)
Is aa alphabetically before or string-equal to z?  TRUE. (a < z 
alphabetically, the second character is never checked).
Is ab alphabetically before or string-equal to z?  TRUE.
...
Is yz alphabetically before or string-equal to z?  TRUE.
Is za alphabetically before or string-equal to z?  FALSE.  (a alphabetically 
after NULL character.  Bob is alphabetically before Bobby for the same 
reason.)

See how the comparison works?  It's a purely alphabetic comparison.

As for the increment, it actually would never have occurred to me to ++ a 
string before this thread, honestly. :-)  However, what it appears to be 
doing (and I'm sure Rasmus will correct me if I'm wrong) is using a "string 
base" instead of a numeric base.  Thus a++ = b, b++=c, etc.  z++ "rolls over" 
to the next "digit" (which because it's a string goes to the right rather 
than the left), and resets.  So just as 9++ rolls over to 10, z rolls over to 
aa.

Does that make more sense?

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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

Reply via email to