"; echo decbin("1") . "
"; echo decbin("1587") . "
"; echo decbin("7");"> "; echo decbin("1") . "
"; echo decbin("1587") . "
"; echo decbin("7");" />
Easy Tutorial
❮ Func Xml Set Unparsed Entity Decl Handler Pdostatement Bindcolumn ❯

PHP decbin() Function

PHP Math Reference Manual

Example

Convert decimal to binary:

<?php
echo decbin("3") . "<br>";
echo decbin("1") . "<br>";
echo decbin("1587") . "<br>";
echo decbin("7");
?>

Definition and Usage

The decbin() function converts a decimal number to a binary number.

Tip: To convert binary to decimal, see the bindec() function.


Syntax

Parameter Description
number Required. Specifies the decimal value to convert.

Technical Details

Return Value: A string containing the binary number of the decimal value.
Return Type: String
--- ---
PHP Version: 4+
--- ---
❮ Func Xml Set Unparsed Entity Decl Handler Pdostatement Bindcolumn ❯