Re: Re: Generate Alphabet
| From: | Bogdan Stancescu | Date: | Fri, 28 Dec 2001 13:49:49 +0000 |
| Subject: | Re: Re: Generate Alphabet | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78933@lists.php.net to get a copy of this message | ||
Philip Olson wrote:
> > I seriously doubt your code works -- have you tested it? I think the code
> > you submitted will most probably output "1 2 3 4...24 25 26" (spaces are
> > actually \n's). I never tested it though, so I may be mistaken.
>
> Yes, it works. Test it before posting such doubts :)
>
> Regards,
> Philip Olson
Ok, tested it and to my surprize it does work. But why?!
Questions:
1. $letter++ -- why doesn't this evaluate $letter as integer before
incrementing?
2. print $letter++ -- why doesn't this evaluate to "b" at the first loop when
it's already 'a'? Ok, this I may be able to explain because it's neither
"print
++$letter" nor "print ($letter++)", but I wouldn't have trusted this syntax to
work this way a million years!
Nice, elegant code indeed! Apologies for doubting it! :-)
Bogdan