Re: When is "z" != "z" ?
| From: | Larry Garfield | Date: | Sun, 04 Jun 2006 21:37:09 +0000 |
| Subject: | Re: When is "z" != "z" ? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237381@lists.php.net to get a copy of this message | ||
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@garfieldtech.com 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