decbin() function in PHP


The decbin() function converts a decimal number to binary number.

Syntax

decbin(num)

Parameters

  • num − Specifies a number to be converted to binary.

Return

The decbin() function Returns a string representing the binary number of the decimal value.

Example

 Live Demo

<?php
   echo decbin("3865");
?>

Output

111100011001

Example

Let us see another example −

 Live Demo

<?php
   echo decbin("99");
?>

Output

1100011

Updated on: 26-Dec-2019

54 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements