PHP decbin is an inbuilt Math Function in PHP. It converts an input decimal integer into its corresponding binary representation string.
You can convert a binary string to its corresponding decimal integer using PHP bindec Function.
Syntax
decbin ($integer)
Parameters
The function accepts only one parameter. The decimal value for which you want to find the binary representation is the input to the function.
Return Value
The function returns the corresponding binary string for the decimal value.
Input: decbin(4) Output: 100 Input: decbin(2147483647) Output: 1111111111111111111111111111111 (31 1s) Input: decbin(-1) Output: 11111111111111111111111111111111 (32 1s)

Examples
For example, consider the following cases to observe the functioning of the function in PHP.
<?php echo decbin(4); //100 echo decbin(2147483647); //1111111111111111111111111111111 echo decbin(-1); //11111111111111111111111111111111 ?>
Conclusion
In conclusion, we discussed the PHP decbin Function. You can read more about it on the Official PHP Documentation. Additionally, you can also read more about PHP Math Functions on Concatly.

Vishesh is currently working as a Lead Software Engineer at Naukri.com. He passed out of Delhi College of Engineering in 2016 and likes to play Foosball. He loves traveling and is an exercise freak. His expertise includes Java, PHP, Python, Databases, Design and Architecture.