Home >>PHP Math Functions >PHP decbin() Function
PHP decbin() function is used to convert a given input decimal number argument into a string containing a binary representation of that decimal number argument. It accepts only a single parameter $number which is the decimal number to be converted in binary representation. It returns a string that represent the binary value of the provided input decimal number passed as argument.
Syntax:
decbin($number);
Parameter | Description |
---|---|
number | This is a required parameter. This parameter defines the decimal value to be converted. |
Here is an example of decbin() function in PHP:
<html> <body> <?php echo decbin("8")."<br>"; echo decbin("17")."<br>"; ?> </body> </html>
Here is an another example of decbin() function in PHP:
<html> <body> <?php echo decbin("234")."<br>"; echo decbin("23.33")."<br>"; echo decbin("5")."<br>"; echo decbin("55")."<br>"; ?> </body> </html>