PHP decbin()

arisdelaCruz1413618857's avatar
Published Jul 8, 2023
Contribute to Docs

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

  • 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

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

<?php
echo decbin(333);
?>

This will result in the following output:

101001101

All contributors

Contribute to Docs

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