Convert decimal to binary:
<?php
echo decbin("3") . "<br>";
echo decbin("1") . "<br>";
echo decbin("1587") . "<br>";
echo decbin("7");
?>
Try it Yourself »
The decbin() function converts a decimal number to a binary number.
Tip: To convert binary to decimal, look at the bindec() function.
decbin(
number);
Parameter | Description |
---|---|
number | Required. Specifies the decimal value to convert |
Return Value: | A string that contains the binary number of the decimal value |
---|---|
Return Type: | String |
PHP Version: | 4+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!