php-doc-en/reference/math/functions/bindec.xml
Nuno Lopes 5270d15f58 added example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@146663 c90b9560-bf6c-de11-be94-00142212c4b1
2003-12-17 16:02:19 +00:00

77 lines
1.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/math.xml, last change in rev 1.2 -->
<refentry id="function.bindec">
<refnamediv>
<refname>bindec</refname>
<refpurpose>Binary to decimal</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>bindec</methodname>
<methodparam><type>string</type><parameter>binary_string</parameter></methodparam>
</methodsynopsis>
<para>
Returns the decimal equivalent of the binary number represented by
the <parameter>binary_string</parameter> argument.
</para>
<para>
<function>bindec</function> converts a binary number to an
<type>integer</type>. The largest number that can be converted is
31 bits of 1's or 2147483647 in decimal.
</para>
<para>
<example>
<title><function>bindec</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo bindec('110011') . "\n";
echo bindec('000110011') . "\n";
echo bindec('111');
?>
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
51
51
7
]]>
</screen>
</example>
</para>
<para>
See also <function>decbin</function>,
<function>octdec</function>,
<function>hexdec</function> and
<function>base_convert</function>.
</para>
</refsect1>
</refentry>
<!-- 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
sgml-default-dtd-file:"../../../../manual.ced"
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
-->