The case for $b = $b++ is actually  
$b = $b; 
$b = $b + 1;

The case for $b = ++$b is 
$b = $b + 1; 
$b = $b ;

It depends on where the ++ operation's sequency to run.
For evaluate this, you can try : 

print $b++; print " $b" ; # Result is "1 2"
print ++$b; print " $b" ; # Result is "2 2"

Hope this help,
Smiley Connie =)


----- Original Message ----- 
From: "Michael Turner" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 30, 2002 10:25 PM
Subject: what happens with $b = $b++?


> OK, here is a "real" beginners question, but interesting nonetheless:
> 
> Sample code:
> 
> $b = 1;
> $b = $b++;
> 
> Result:
> 
> $b = 1
> 
> Which strikes me as a little surprising. Shouldn't the result be 2? What 
> is happening?
> 
> If you respond, please CC me. Many TIA
> 
> /Michael Turner
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to