⊗ppPmCdNIf 96 of 447 menu

Nested If Statements in PHP

if else constructs can be nested within each other arbitrarily. See the example:

<?php $num = 3; if ($num >= 0) { if ($num <= 5) { echo 'less than or equal to 5'; } else { echo 'more than 5'; } } else { echo 'less than zero'; } ?>

Let the variable $age store a number. If this number is less than 10 or greater than 99, then display a message about it. If the number falls within the specified range, then find the sum of the digits of this number. If the resulting sum is less than or equal to 9, then display a message that the sum of digits is single-digit, otherwise display a message that the sum of digits is two-digit.

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