PHP decbin () function
Examples
The decimal to binary:
<?php
echo decbin("3") . "<br>";
echo decbin("1") . "<br>";
echo decbin("1587") . "<br>";
echo decbin("7");
?>
echo decbin("3") . "<br>";
echo decbin("1") . "<br>";
echo decbin("1587") . "<br>";
echo decbin("7");
?>
Running instance »
Definition and Usage
decbin () function to convert decimal numbers to binary numbers.
Tip: If you need to convert binary to decimal, see bindec () function
grammar
decbin( number );
参数 | 描述 |
---|---|
number | 必需。规定要转换的十进制值。 |
technical details
return value: | A string containing the binary decimal values. |
---|---|
Return type: | String |
PHP version: | 4+ |
PHP Math Reference