Re: something funny
| From: | Sebastian Delmont | Date: | Tue, 28 Nov 2000 19:41:52 +0000 |
| Subject: | Re: something funny | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27664@lists.php.net to get a copy of this message | ||
probably php's string arithmetics are not exactly what you expect... it's
not like C... and you are working with strings, not chars... so when $j =
"z", since it's still <= "z" it does a $j++, and it seems that
"z" + 1 ==
"aa", but on the other hand "aa" is <= "z"...
IMHO, PHP shouldn't allow "string"++... or it should guarantee that
"string"++ will be > than "string"...
----- Original Message -----
From: ""Slavko Dervisevic"" <slavkod@EUnet.yu>
Newsgroups: php.general
Sent: Tuesday, November 28, 2000 2:56 PM
Subject: [PHP] something funny
> for ($j="a";$j<="z";$j++){
> echo $j."-";
> }
>
> is supposed to produce string a-b-c-...-z-
> but it produces a-b-..-z-aa-ab-...-yz
> what is wrong?
>
> =====================
> Slavko Dervisevic
> Agencija INSIDE
> http://www.unovomsadu.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>