⊗ppPmCdLOr 79 of 447 menu

Logical OR in PHP

Logical OR requires the fulfillment of at least one condition. In the following example, the condition will be met if the variable $num1 is greater than 0 or the variable $num2 is greater than 0 (it is sufficient to fulfill at least one of the conditions):

<?php $num1 = 10; $num2 = -5; if ($num1 > 0 or $num2 > 0) { echo '+++'; // this will work } else { echo '---'; } ?>

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

<?php $num1 = -10; $num2 = -10; if ($num1 >= 0 or $num2 >= 0) { echo '+++'; } else { echo '---'; } ?>

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

<?php $num1 = 0; $num2 = 0; if ($num1 >= 0 or $num2 >= 0) { echo '+++'; } else { echo '---'; } ?>

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

<?php $num1 = 0; $num2 = 5; if ($num1 >= 0 or $num2 >= 0) { echo '+++'; } else { echo '---'; } ?>

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

<?php $num1 = 5; $num2 = 5; if ($num1 >= 0 or $num2 >= 0) { echo '+++'; } else { echo '---'; } ?>

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

<?php $num1 = -5; $num2 = 15; if ($num1 >= 0 or $num2 >= 0) { echo '+++'; } else { echo '---'; } ?>

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

<?php $num = 1; if ($num == 0 or $num == 1) { echo '+++'; } else { echo '---'; } ?>

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

<?php $num = 2; if ($num == 0 or $num == 1) { echo '+++'; } else { echo '---'; } ?>

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

<?php $num = 2; if ($num == 0 or $num == 1 or $num == 2) { echo '+++'; } else { echo '---'; } ?>
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