PHP decbin()
Published Jul 8, 2023
The decbin() function converts a decimal number to a string containing a binary number.
Syntax
decbin(number);
Where number is the decimal value to be converted to binary. The result returns a string that contains the binary number of the passed decimal value.
Example
<?phpecho decbin(333);?>
This will result in the following output:
101001101
Learn PHP on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours