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

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

 



Larry Garfield wrote:
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.

Right, and now bring Unicode into the picture and this becomes even more true.

-Rasmus

--
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