View Single Post
Old 04-15-2009, 08:06 PM   #1 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default Increment, decrement....

Hey guys,

Got a newbie and embarrassing question....

I thought that the ++ would add 1 to a number? Like so:

Code:
$test = 1;

$test2 = $test++;

echo "OUTPUT: $test2";
The output is still 1. I thought that the output should be 2?

Is the only way to use the ++ is in loops?

I thought that the ++ was a quick way to add "1" without having to do this:

$test2 = ($test + 1);
allworknoplay is offline  
Reply With Quote