Convert decimal to binary:
<?phpecho decbin("3") . "<br>";echo decbin("1") . "<br>";echo decbin("1587") . "<br>";echo decbin("7" );?>The decbin() function converts a decimal number to a binary number.
Tip: To convert binary to decimal, check out the bindec() function
decbin( number );
parameter | describe |
---|---|
number | Required. Specifies the decimal value to be converted. |
Return value: | A string containing a binary number with a decimal value. |
---|---|
Return type: | String |
PHP version: | 4+ |