View Single Post
  #42 (permalink)  
Old 05-07-2008, 01:33 AM
senraj senraj is offline
D-Web Master
 
Join Date: Jul 2007
Posts: 418
senraj is on a distinguished road
Post Re: Operations in PHP

Hi,

Increment/decrement operators

As you can see from the previous table, there’s a difference in the value of
post- and pre-increment. However, in both cases, $var is incremented by 1. The
only difference is in the value to which the increment expression evaluates.
Example 1:
$num1 = 5;
$num2 = $num1++;// post-increment, $num2 is assigned $num1's original
➥value
print $num1; // this will print the value of $num1, which is now 6
print $num2; // this will print the value of $num2, which is the
➥original value of $num1, thus, 5
__________________
Regards,
Senraj.A
Reply With Quote