Horje Website
PHP Change Operator Precedence Using Parentheses – Learn Change operator precedence using parentheses – PHP Code

PHP Change Operator Precedence Using Parentheses – Learn Change operator precedence using parentheses

PHP Change Operator Precedence Using Parentheses - Learn Change operator precedence using parentheses - PHP Code


 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>PHP Change Operator Precedence Using Parentheses</title>
  5. </head>
  6. <body>
  7. <?php
  8. echo 5 + 4 * 10 . "<br>"; // 0utputs: 45
  9. echo (5 + 4) * 10 . "<br>"; // 0utputs: 90
  10. echo 5 + 4 * 10 / 2 . "<br>"; // 0utputs: 25
  11. echo 8 * 10 / 4 - 2 . "<br>"; // 0utputs: 18
  12. echo 8 * 10 / (4 - 2) . "<br>"; // 0utputs: 40
  13. echo 8 + 10 / 4 - 2 . "<br>"; // 0utputs: 8.5
  14. echo (8 + 10) / (4 - 2) . "<br>"; // 0utputs: 9
  15. ?>
  16. </body>
  17. </html>



Try Your Self ->



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

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