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

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

 



On Sunday 04 June 2006 15:04, tedd wrote:

> Yes, it is my contention that strings are numerical -- you don't store "A"
> in memory, you store 0100 001, or ASCII DEC 65.

In a low-level language like C, that matters.  One doesn't have strings, one 
has numbers that happen to map to a symbol.

In PHP and other high-level languages, strings are their own datatype.  They 
may or may not even be stored as standard ascii number codes in order 
internally.  You have to think of them as strings, not as numbers.  There are 
no numbers involved here.  There are only strings.  

> Likewise "a" is DEC 97 (0110 0001) and "z" is DEC 122 (0111 1010) and if I
> compare "a" to "z" , it will always be less by numeric definition.

In C or C++, yes.  In PHP, do not assume the same string->number mapping.  
Numeric definition is irrelevant.

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		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


[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