note 96596 deleted from language.operators.arithmetic by danbrown

From: Date: Sun, 07 Mar 2010 14:51:31 +0000
Subject: note 96596 deleted from language.operators.arithmetic by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166753@lists.php.net to get a copy of this message
Note Submitter: dragos dot rusu at NOSPAM dot bytex dot ro ---- Although some would know this, I had to try in order to understand. Modulus and multiplication operators are not associative; they will execute from left to right. <?php $a = 23; $b = 5; $c = 2; $d = $a % $b * $c; // <=> (23%5) * 2 = 3 * 2 = 6 $d2 = $c * $a % $b; // <=> (2*23) % 5 = 46 % 5 = 1 var_dump($d); var_dump($d2);

« previous php.notes (#166753) next »