PHP decbin()Function

PHP Math 参考手册PHP Math Reference Manual

Examples

Convert decimal to binary:

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

Run example »

Definition and Usage

The decbin() function converts decimal numbers to binary numbers.

Tip:To convert binary to decimal, seebindec()Function


Syntax

decbin(number);

Parameters Description
number Required. Specifies the decimal value to be converted.

Technical Details

Return value: A string containing the binary representation of the decimal value.
Return type: String
PHP version: 4+


PHP Math 参考手册PHP Math Reference Manual Other Extensions