derick Sun Nov 9 07:17:32 2003 EDT
Modified files: /phpdoc/en/language operators.xml Log: - Clarify operators a bit for newbies Index: phpdoc/en/language/operators.xml diff -u phpdoc/en/language/operators.xml:1.53 phpdoc/en/language/operators.xml:1.54 --- phpdoc/en/language/operators.xml:1.53 Sat Jul 19 15:37:59 2003 +++ phpdoc/en/language/operators.xml Sun Nov 9 07:17:31 2003 @@ -1,9 +1,28 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.53 $ --> +<!-- $Revision: 1.54 $ --> <chapter id="language.operators"> <title>Operators</title> <simpara> + An operator is something that you feed with one or more values (or + expressions in the programing jargon) and yields another value (so that the + construction itself becomes an expression). So you can think of functions + or constructions that return a value (like print) as operators and those + that return nothing (like echo) as any other thing. </simpara> + <para> + There are a few types of operators, there is the unairy operator which + operates on only one value, for example ! (the negation operator) or ++ + (the increment operator). The second group is called binary operators; this + group contains of the most operators that PHP supports and a list follows + below in the section <link linkend="language.operators.precedence">Operator + Precedence</link>. + </para> + <para> + The third 'group is the ternairy operator: ?:. It should be used to select + between two expressions depending on a third one, not to select two + sentences or paths of execution. And always surrounding ?: expressions with + parenthesis is also a very good idea. + </para> <sect1 id="language.operators.precedence"> <title>Operator Precedence</title> @@ -216,9 +235,10 @@ </para> <para> In addition to the basic assignment operator, there are "combined - operators" for all of the binary arithmetic and string operators - that allow you to use a value in an expression and then set its - value to the result of that expression. For example: + operators" for all of the <link linkend="language.operators">binary + arithmetic</link> and string operators that allow you to use a value in an + expression and then set its value to the result of that expression. For + example: <informalexample> <programlisting role="php"> <![CDATA[