2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:35:26 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.bccomp" xmlns="http://docbook.org/ns/docbook">
|
2007-01-27 00:21:08 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>bccomp</refname>
|
|
|
|
<refpurpose>Compare two arbitrary precision numbers</refpurpose>
|
|
|
|
</refnamediv>
|
2007-01-27 16:51:44 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-01-27 00:21:08 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>int</type><methodname>bccomp</methodname>
|
2015-04-01 19:37:26 +00:00
|
|
|
<methodparam><type>string</type><parameter>left_operand</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>right_operand</parameter></methodparam>
|
2015-12-20 00:00:25 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>scale</parameter><initializer>0</initializer></methodparam>
|
2007-01-27 00:21:08 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Compares the <parameter>left_operand</parameter> to the
|
|
|
|
<parameter>right_operand</parameter> and returns the result as an
|
2007-01-27 16:51:44 +00:00
|
|
|
integer.
|
2007-01-27 00:21:08 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-01-27 16:51:44 +00:00
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>left_operand</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The left operand, as a string.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>right_operand</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The right operand, as a string.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>scale</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The optional <parameter>scale</parameter> parameter is used to set the
|
|
|
|
number of digits after the decimal place which will be used in the
|
|
|
|
comparison.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns 0 if the two operands are equal, 1 if the
|
|
|
|
<parameter>left_operand</parameter> is larger than the
|
|
|
|
<parameter>right_operand</parameter>, -1 otherwise.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
2007-01-27 00:21:08 +00:00
|
|
|
&reftitle.examples;
|
|
|
|
<example>
|
|
|
|
<title><function>bccomp</function> example</title>
|
|
|
|
<programlisting role="php">
|
2003-12-18 10:02:11 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
2004-08-10 23:40:27 +00:00
|
|
|
echo bccomp('1', '2') . "\n"; // -1
|
|
|
|
echo bccomp('1.00001', '1', 3); // 0
|
|
|
|
echo bccomp('1.00001', '1', 5); // 1
|
|
|
|
|
2003-12-18 10:02:11 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2007-01-27 00:21:08 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|