<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.decbin" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>decbin</refname>
  <refpurpose>Decimal to binary</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>decbin</methodname>
   <methodparam><type>int</type><parameter>num</parameter></methodparam>
  </methodsynopsis>
  <para>
   Returns a string containing a binary representation of the given
   <parameter>num</parameter> argument.
  </para>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>num</parameter></term>
     <listitem>
      <para>
       Decimal value to convert
      </para>

      <table>
       <title>Range of inputs on 32-bit machines</title>
       <tgroup cols="3">
        <colspec colname="c1"/>
        <colspec colname="c2"/>
        <colspec colname="c3"/>
        <thead>
         <row>
          <entry>positive <parameter>num</parameter></entry>
          <entry>negative <parameter>num</parameter></entry>
          <entry>return value</entry>
         </row>
        </thead>
        <tbody>
         <row>
          <entry>0</entry>
          <entry/>
          <entry>0</entry>
         </row>
         <row>
          <entry>1</entry>
          <entry/>
          <entry>1</entry>
         </row>
         <row>
          <entry>2</entry>
          <entry/>
          <entry>10</entry>
         </row>
         <row>
          <entry namest="c1" nameend="c3">... normal progression ...</entry>
         </row>
         <row>
          <entry>2147483646</entry>
          <entry/>
          <entry>1111111111111111111111111111110</entry>
         </row>
         <row>
          <entry>2147483647 (largest signed integer)</entry>
          <entry/>
          <entry>1111111111111111111111111111111 (31 1's)</entry>
         </row>
         <row>
          <entry>2147483648</entry>
          <entry>-2147483648</entry>
          <entry>10000000000000000000000000000000</entry>
         </row>
         <row>
          <entry namest="c1" nameend="c3">... normal progression ...</entry>
         </row>
         <row>
          <entry>4294967294</entry>
          <entry>-2</entry>
          <entry>11111111111111111111111111111110</entry>
         </row>
         <row>
          <entry>4294967295 (largest unsigned integer)</entry>
          <entry>-1</entry>
          <entry>11111111111111111111111111111111 (32 1's)</entry>
         </row>
        </tbody>
       </tgroup>
      </table>

      <table>
       <title>Range of inputs on 64-bit machines</title>
       <tgroup cols="3">
        <colspec colname="c1"/>
        <colspec colname="c2"/>
        <colspec colname="c3"/>
        <thead>
         <row>
          <entry>positive <parameter>num</parameter></entry>
          <entry>negative <parameter>num</parameter></entry>
          <entry>return value</entry>
         </row>
        </thead>
        <tbody>
         <row>
          <entry>0</entry>
          <entry/>
          <entry>0</entry>
         </row>
         <row>
          <entry>1</entry>
          <entry/>
          <entry>1</entry>
         </row>
         <row>
          <entry>2</entry>
          <entry/>
          <entry>10</entry>
         </row>
         <row>
          <entry namest="c1" nameend="c3">... normal progression ...</entry>
         </row>
         <row>
          <entry>9223372036854775806</entry>
          <entry/>
          <entry>111111111111111111111111111111111111111111111111111111111111110</entry>
         </row>
         <row>
          <entry>9223372036854775807 (largest signed integer)</entry>
          <entry/>
          <entry>111111111111111111111111111111111111111111111111111111111111111 (63 1's)</entry>
         </row>
         <row>
          <entry/>
          <entry>-9223372036854775808</entry>
          <entry>1000000000000000000000000000000000000000000000000000000000000000</entry>
         </row>
         <row>
          <entry namest="c1" nameend="c3">... normal progression ...</entry>
         </row>
         <row>
          <entry/>
          <entry>-2</entry>
          <entry>1111111111111111111111111111111111111111111111111111111111111110</entry>
         </row>
         <row>
          <entry/>
          <entry>-1</entry>
          <entry>1111111111111111111111111111111111111111111111111111111111111111 (64 1's)</entry>
         </row>
        </tbody>
       </tgroup>
      </table>

     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Binary string representation of <parameter>num</parameter>
  </para>
 </refsect1>
 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>decbin</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
echo decbin(12) . "\n";
echo decbin(26);
?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
1100
11010
]]>
    </screen>
   </example>
  </para>
 </refsect1>
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>bindec</function></member>
    <member><function>decoct</function></member>
    <member><function>dechex</function></member>
    <member><function>base_convert</function></member>
    <member>
     <function>printf</function>, using <literal>%b</literal>,
     <literal>%032b</literal> or <literal>%064b</literal> as the format
    </member>
    <member>
     <function>sprintf</function>, using <literal>%b</literal>,
     <literal>%032b</literal> or <literal>%064b</literal> as the format
    </member>
   </simplelist>
  </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:"~/.phpdoc/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
-->
