Re: Re: Generate Alphabet
| From: | Daniel Grace | Date: | Wed, 02 Jan 2002 12:33:49 +0000 |
| Subject: | Re: Re: Generate Alphabet | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79215@lists.php.net to get a copy of this message | ||
"Bogdan Stancescu" <mgv@fx.ro> wrote in message
news:3C2C787D.602B807@fx.ro...
> 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!
>
$foo++ is 'postfix', ++$foo is 'prefix' This means that the addition of 1
occurs AFTER (hence post) the expression's value is returned, not before.
In other words, it's equivalent to this:
print $foo;
$foo = $foo + 1;
not this:
$foo = $foo + 1;
print $foo;
-- Daniel Grace