Welcome Guest, Not a member yet? Register   Sign In
why result is 7?
#5

[eluser]InsiteFX[/eluser]
Operator Precedence - SEE the PHP Manual.

Code:
<?php
$i = 1;
// notice here I wrapped the increments with
// a beginning and ending parentheses.
// parentheses may be used to force precedence
echo "i=".((++$i)+(++$i)+(++$i)); //result 9
//echo (++$i)+(++$i)+(++$i); //result is 9
?>

InsiteFX


Messages In This Thread
why result is 7? - by El Forum - 06-20-2010, 09:27 PM
why result is 7? - by El Forum - 06-20-2010, 09:58 PM
why result is 7? - by El Forum - 06-20-2010, 10:20 PM
why result is 7? - by El Forum - 06-20-2010, 11:27 PM
why result is 7? - by El Forum - 06-21-2010, 12:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB