cvs: phpdoc /en/functions info.xml

From: Date: Sun, 11 Nov 2001 12:29:50 +0000
Subject: cvs: phpdoc /en/functions info.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969338669@lists.php.net to get a copy of this message
goba Sun Nov 11 07:29:50 2001 EDT Modified files: /phpdoc/en/functions info.xml Log: Adding that nice version_compare function, with examples Index: phpdoc/en/functions/info.xml diff -u phpdoc/en/functions/info.xml:1.71 phpdoc/en/functions/info.xml:1.72 --- phpdoc/en/functions/info.xml:1.71 Sun Nov 11 07:13:02 2001 +++ phpdoc/en/functions/info.xml Sun Nov 11 07:29:50 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.71 $ --> +<!-- $Revision: 1.72 $ --> <reference id="ref.info"> <title>PHP options &amp; information</title> <titleabbrev>PHP options/info</titleabbrev> @@ -1483,7 +1483,8 @@ </example> </para> <para> - See also <function>phpinfo</function>, + See also <function>version_compare</function>, + <function>phpinfo</function>, <function>phpcredits</function>, <function>php_logo_guid</function>, <function>zend_version</function>. @@ -1720,6 +1721,68 @@ has been running. </para> </note> + </refsect1> + </refentry> + + <refentry id="function.version-compare"> + <refnamediv> + <refname>version_compare</refname> + <refpurpose>Compares two "PHP-standardized" version number strings</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>version_compare</function></funcdef> + <paramdef>string <parameter>version1</parameter></paramdef> + <paramdef>string <parameter>version2</parameter></paramdef> + <paramdef>string + <parameter> + <optional>operator</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>version_compare</function> compares + two "PHP-standardized" version number strings. This + is useful if you would like to write programs working + only on some versions of PHP. + </para> + <para> + <function>version_compare</function> returns -1 if + the first version is lower than the second, 0 if they + are equal, and +1 if the second is lower. + </para> + <para> + If you specify the third optional + <parameter>operator</parameter> argument, you + can test for a particular relationship. The possible + operators are: <literal>&lt;</literal>, + <literal>lt</literal>, <literal>&lt;=</literal>, + <literal>le</literal>, <literal>&gt;</literal>, + <literal>gt</literal>, <literal>&gt;=</literal>, + <literal>ge</literal>, <literal>==</literal>, + <literal>=</literal>, <literal>eq</literal>, + <literal>!=</literal>, <literal>&lt;&gt;</literal>, + <literal>ne</literal> respectively. Using + this argument, the function will return 1 if + the realtionship is the one specified by the + operator, 0 otherwise. + </para> + <para> + <example> + <title><function>version_compare</function> example</title> + <programlisting role="php"> +// prints -1 +echo version_compare("4.0.4", "4.0.6"); + +// the all print 1 +echo version_compare("4.0.4", "4.0.6", "&lt;"); +echo version_compare("4.0.6", "4.0.6", "eq"); + </programlisting> + </example> + </para> </refsect1> </refentry>

« previous php.doc (#969338669) next »