Cheers!

"Jochem Maas" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
> William Stokes wrote:
>> What does this do in a for loop?
>>
>> $counter+=1
>>
>
> it's shorthand for $counter = $counter + 1;
> which in this case (because 1 is being added)
> can also be written as:
>
> $counter++;
>
> or
>
> ++$counter;
>
>
> those last 2 alternatives give the same result
> but they are _not_ exactly equivalent - it has to do
> with when the incrementation is done when such expression
> appears inside a more complex expression e.g.
>
> $counter = 1;
> $x = ++$counter;
> $counter = 1;
> $y = $counter++;
> echo $x,",",$y,"\n"; // outputs: 2,1
>
>
>>
>>
>> Thanks
>>
>> -Will
>> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to