Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP decbin() Function

PHP decbin() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Convert decimal to binary:

" ; echo decbin ( " 1 " ) . "
" ; echo decbin ( " 1587 " ) . "
" ; echo decbin ( " 7 " ) ; ?>

Run Example »


Definition and Usage

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

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


Syntax

decbin(

number

);

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

Technical Details

Return Value: A string containing the binary representation of the decimal value.
Return Type: String
PHP Version: 4+

PHP Math Reference Manual PHP Math Reference Manual