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

PHP Convert a Decimal Number to Octal and Vice Versa – Learn Convert a decimal number to octal and vice versa

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


 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>PHP Convert a Decimal Number to Octal and Vice Versa</title>
  5. </head>
  6. <body>
  7. <?php
  8. // Convert decimal to octal
  9. echo decoct(12) . "<br>"; // 0utputs: 14
  10. echo decoct(256) . "<br>"; // 0utputs: 400
  11. echo decoct(77) . "<br>"; // 0utputs: 115
  12. // Convert octal to decimal
  13. echo octdec('14') . "<br>"; // 0utputs: 12
  14. echo octdec('400') . "<br>"; // 0utputs: 256
  15. echo octdec('115') . "<br>"; // 0utputs: 77
  16. ?>
  17. </body>
  18. </html>



Try Your Self ->



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

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