Sophie

Sophie

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

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

<HTML
><HEAD
><TITLE
>version_compare</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="PHP Options&Information"
HREF="ref.info.html"><LINK
REL="PREVIOUS"
TITLE="set_time_limit"
HREF="function.set-time-limit.html"><LINK
REL="NEXT"
TITLE="zend_logo_guid"
HREF="function.zend-logo-guid.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
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="function.set-time-limit.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.zend-logo-guid.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.version-compare"
></A
>version_compare</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN75351"
></A
><P
>    (PHP 4 &#62;= 4.1.0)</P
>version_compare&nbsp;--&nbsp;
     Compares two "PHP-standardized" version number strings
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN75354"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>version_compare</B
> ( string version1, string version2 [, string operator])<BR
></BR
><P
>&#13;     <B
CLASS="function"
>version_compare()</B
> compares two
     "PHP-standardized" version number strings. This is useful if you
     would like to write programs working only on some versions of
     PHP.
    </P
><P
>&#13;     <B
CLASS="function"
>version_compare()</B
> returns -1 if the first
     version is lower than the second, 0 if they are equal, and +1 if
     the second is lower.
    </P
><P
>&#13;     If you specify the third optional <TT
CLASS="parameter"
><I
>operator</I
></TT
>
     argument, you can test for a particular relationship. The
     possible operators are: <TT
CLASS="literal"
>&#60;</TT
>,
     <TT
CLASS="literal"
>lt</TT
>, <TT
CLASS="literal"
>&#60;=</TT
>,
     <TT
CLASS="literal"
>le</TT
>, <TT
CLASS="literal"
>&#62;</TT
>,
     <TT
CLASS="literal"
>gt</TT
>, <TT
CLASS="literal"
>&#62;=</TT
>,
     <TT
CLASS="literal"
>ge</TT
>, <TT
CLASS="literal"
>==</TT
>,
     <TT
CLASS="literal"
>=</TT
>, <TT
CLASS="literal"
>eq</TT
>,
     <TT
CLASS="literal"
>!=</TT
>, <TT
CLASS="literal"
>&#60;&#62;</TT
>,
     <TT
CLASS="literal"
>ne</TT
> respectively. Using this argument, the
     function will return 1 if the relationship is the one specified
     by the operator, 0 otherwise.
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN75389"
></A
><P
><B
>Example 1. <B
CLASS="function"
>version_compare()</B
> Example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>// prints -1
echo version_compare("4.0.4", "4.0.6");

// these all print 1
echo version_compare("4.0.4", "4.0.6", "&#60;");
echo version_compare("4.0.6", "4.0.6", "eq");</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </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="function.set-time-limit.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="function.zend-logo-guid.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>set_time_limit</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.info.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>zend_logo_guid</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>