vrana Mon Jul 26 09:24:22 2004 EDT
Modified files: /phpdoc/en/language operators.xml Log: Associativity (bug #10351) http://cvs.php.net/diff.php/phpdoc/en/language/operators.xml?r1=1.72&r2=1.73&ty=u Index: phpdoc/en/language/operators.xml diff -u phpdoc/en/language/operators.xml:1.72 phpdoc/en/language/operators.xml:1.73 --- phpdoc/en/language/operators.xml:1.72 Wed Jul 7 04:35:54 2004 +++ phpdoc/en/language/operators.xml Mon Jul 26 09:24:22 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.72 $ --> +<!-- $Revision: 1.73 $ --> <chapter id="language.operators"> <title>Operators</title> <simpara> @@ -137,6 +137,26 @@ </tbody> </tgroup> </table> + </para> + <para> + Left associativity means that the expression is evaluated from left to right, + right associativity means the opposite. + <example> + <title>Associativity</title> + <programlisting role="php"> +<![CDATA[ +<?php +$a = 3 * 3 % 5; // (3 * 3) % 5 = 4 +$a = true ? 0 : true ? 1 : 2; // (true ? 0 : true) ? 1 : 2 = 2 + +$a = 1; +$b = 2; +$a = $b += 3; // $a = ($b += 3) -> $a = 5, $b = 5 +?> +]]> + </programlisting> + </example> + Use parentheses to increase readability of the code. </para> <note> <para>