Horje Website
PHP Convert a Decimal Number to Binary and Vice Versa – Learn Convert a decimal number to binary and vice versa – PHP Code

PHP Convert a Decimal Number to Binary and Vice Versa – Learn Convert a decimal number to binary and vice versa

PHP Convert a Decimal Number to Binary and Vice Versa - Learn Convert a decimal number to binary and vice versa - PHP Code


 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>PHP Convert a Decimal Number to Binary and Vice Versa</title>
  5. </head>
  6. <body>
  7. <?php
  8. // Convert Decimal to Binary
  9. echo decbin(2) . "<br>"; // 0utputs: 10
  10. echo decbin(12) . "<br>"; // 0utputs: 1100
  11. echo decbin(100) . "<br>"; // 0utputs: 1100100
  12. // Convert Binary to Decimal
  13. echo bindec(10) . "<br>"; // 0utputs: 2
  14. echo bindec(1100) . "<br>"; // 0utputs: 12
  15. echo bindec(1100100) . "<br>"; // 0utputs: 100
  16. ?>
  17. </body>
  18. </html>



Try Your Self ->



Published:
September 25, 2020
Author:
admin
Category:
PHP Basic, PHP Source Code
Views:
16

This article was posted in PHP Basic, PHP Source Code and tagged , , . Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Horje © 2011 - 2022