Sophie

Sophie

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

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

<HTML
><HEAD
><TITLE
>Comparison 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="Operators"
HREF="language.operators.html"><LINK
REL="PREVIOUS"
TITLE="Bitwise Operators"
HREF="language.operators.bitwise.html"><LINK
REL="NEXT"
TITLE="Error Control Operators"
HREF="language.operators.errorcontrol.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="sect1"
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.operators.bitwise.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 11. Operators</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="language.operators.errorcontrol.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="language.operators.comparison"
></A
>Comparison Operators</H1
><P
>&#13;    Comparison operators, as their name implies, allow you to compare
    two values.
   </P
><DIV
CLASS="table"
><A
NAME="AEN4558"
></A
><P
><B
>Table 11-4. Comparison Operators</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
>Example</TH
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
>Name</TH
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
>Result</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a == $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Equal</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is equal to $b.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a === $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Identical</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;	<TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is equal to $b, and they are of the same
	type. (PHP 4 only)
       </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a != $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Not equal</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is not equal to $b.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a &#60;&#62; $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Not equal</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is not equal to $b.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a !== $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Not identical</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;	<TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is not equal to $b, or they are not of the same
	type. (PHP 4 only)
       </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a &#60; $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Less than</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is strictly less than $b.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a &#62; $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Greater than</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is strictly greater than $b.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a &#60;= $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Less than or equal to </TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is less than or equal to $b.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$a &#62;= $b</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Greater than or equal to </TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="constant"
><B
>TRUE</B
></TT
> if $a is greater than or equal to $b.</TD
></TR
></TBODY
></TABLE
></DIV
><P
>&#13;    Another conditional operator is the "?:" (or ternary) operator,
    which operates as in C and many other languages.
    <DIV
CLASS="informalexample"
><A
NAME="AEN4613"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>(expr1) ? (expr2) : (expr3);</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
> 
    This expression evaluates to <TT
CLASS="replaceable"
><I
>expr2</I
></TT
> if
    <TT
CLASS="replaceable"
><I
>expr1</I
></TT
> evaluates to <TT
CLASS="constant"
><B
>TRUE</B
></TT
>, and
    <TT
CLASS="replaceable"
><I
>expr3</I
></TT
> if
    <TT
CLASS="replaceable"
><I
>expr1</I
></TT
> evaluates to <TT
CLASS="constant"
><B
>FALSE</B
></TT
>.
   </P
></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.operators.bitwise.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.errorcontrol.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Bitwise Operators</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="language.operators.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Error Control Operators</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>