⊗ppPmBsMOPa 20 of 447 menu

Grouping Parentheses in PHP

If desired, you can specify the priority of operations using parentheses. Let's, for example, modify our code so that the addition is performed first, and then the multiplication:

<?php $a = 2 * (2 + 3); echo $a; // outputs 10 (result of 2 * 5) ?>

There can be any number of parentheses, including ones nested within each other:

<?php $a = 2 * (2 + 4 * (3 + 1)); echo $a; ?>

Without running the code, determine what will be displayed on the screen:

<?php $a = (2 + 3) * (2 + 3); echo $a; ?>

Without running the code, determine what will be displayed on the screen:

<?php $a = (2 + 3) * 2 + 3; echo $a; ?>

Without running the code, determine what will be displayed on the screen:

<?php $a = 2 * (2 + 4 * (3 + 1)); echo $a; ?>

Without running the code, determine what will be displayed on the screen:

<?php $a = 2 * 8 / 4; echo $a; ?>
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline