Re: Whacky increment/assignment logic with $foo++ vs ++$foo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 5:42 PM -0400 10/2/09, Daniel Brown wrote:
 >

    If you were to use $num++, it would echo out the current number,
THEN increment the value.  In this example, it increments the value,
THEN echoes it out.  The placement of the signs (plus or minus) is the
giveaway: if it's before the variable, it's modified before being
processed.  If it's after, then it's evaluated immediately after the
variable is processed.

That's absolutely true.

The problem here is in the statement of:

$num = $num++;

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux