PHP decbin() Function
Definition and Usage
The decbin() function converts decimal to binary.
Syntax
decbin(dec_number)
Parameter | Description |
---|---|
dec_number | Required. Specifies the decimal number to be converted. |
Description
Returns a string containing the given dec_number Binary representation of parameters. The maximum number that can be converted is 4294967295 in decimal, resulting in a string of 32 ones.
Example
<?php echo decbin("3"); echo decbin("1"); echo decbin("1587"); echo decbin("7"); ?>
Output:
11 1 11000110011 111