Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 2991

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>Operators</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Language Reference"
HREF="langref.html"><LINK
REL="PREVIOUS"
TITLE="Expressions"
HREF="language.expressions.html"><LINK
REL="NEXT"
TITLE="Arithmetic Operators"
HREF="language.operators.arithmetic.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="chapter"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="language.expressions.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="language.operators.arithmetic.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="language.operators"
>Chapter 11. Operators</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="language.operators.html#language.operators.precedence"
>Operator Precedence</A
></DT
><DT
><A
HREF="language.operators.arithmetic.html"
>Arithmetic Operators</A
></DT
><DT
><A
HREF="language.operators.assignment.html"
>Assignment Operators</A
></DT
><DT
><A
HREF="language.operators.bitwise.html"
>Bitwise Operators</A
></DT
><DT
><A
HREF="language.operators.comparison.html"
>Comparison Operators</A
></DT
><DT
><A
HREF="language.operators.errorcontrol.html"
>Error Control Operators</A
></DT
><DT
><A
HREF="language.operators.execution.html"
>Execution Operators</A
></DT
><DT
><A
HREF="language.operators.increment.html"
>Incrementing/Decrementing Operators</A
></DT
><DT
><A
HREF="language.operators.logical.html"
>Logical Operators</A
></DT
><DT
><A
HREF="language.operators.string.html"
>String Operators</A
></DT
><DT
><A
HREF="language.operators.array.html"
>Array Operators</A
></DT
></DL
></DIV
><P
>&#13;  </P
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="language.operators.precedence"
></A
>Operator Precedence</H1
><P
>&#13;    The precedence of an operator specifies how "tightly" it binds two
    expressions together. For example, in the expression <TT
CLASS="literal"
>1 +
    5 * 3</TT
>, the answer is <TT
CLASS="literal"
>16</TT
> and not
    <TT
CLASS="literal"
>18</TT
> because the multiplication ("*") operator
    has a higher precedence than the addition ("+") operator.
    Parentheses may be used to force precedence, if necessary. For
    instance: <TT
CLASS="literal"
>(1 + 5) * 3</TT
> evaluates to
    <TT
CLASS="literal"
>18</TT
>.
   </P
><P
>&#13;    The following table lists the precedence of operators with the
    lowest-precedence operators listed first.
    <DIV
CLASS="table"
><A
NAME="AEN4396"
></A
><P
><B
>Table 11-1. Operator Precedence</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
>Associativity</TH
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
>Operators</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>,</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>or</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>xor</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>and</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>right</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>print</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;         = += -= *= /= .= %= &#38;= |= ^= ~= &#60;&#60;= &#62;&#62;=
        </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>? :</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>||</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#38;&#38;</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>|</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>^</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#38;</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>non-associative</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>== != === !==</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>non-associative</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#60; &#60;= &#62; &#62;=</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#60;&#60; &#62;&#62;</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>+ - .</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>left</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>* / %</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>right</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>! ~ ++ -- (int) (float) (string) (array) (object) @</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>right</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>[</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>non-associative</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>new</TD
></TR
></TBODY
></TABLE
></DIV
>
   </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
     Although <TT
CLASS="literal"
>!</TT
> has a higher precedence than
     <TT
CLASS="literal"
>=</TT
>, PHP will still allow expressions
     similar to the following: <TT
CLASS="literal"
>if (!$a = foo())</TT
>,
     in which case the output from <TT
CLASS="literal"
>foo()</TT
> is
     put into <TT
CLASS="varname"
>$a</TT
>.
    </P
></BLOCKQUOTE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="language.expressions.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="language.operators.arithmetic.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Expressions</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="langref.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Arithmetic Operators</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>