Logical Operators

Logical Operators allow your script to determine the status of conditions (such as the comparisons in the preceding section). In the context of if…else or while statements, logical operators execute certain code based on which conditions are true and which are false.
For now, focus on the && (and) and || (or) operators to determine the validity of a few comparisons.

<TITLE>Using Logical Operators</TITLE>
$degrees = “95”;
$hot = “yes”;
echo statements will print:
if (($degrees > 100) || ($hot == “yes”)) {
echo “<P>TEST 1: It’s <strong>really</strong> hot!</P>”;
} else {
echo “<P>TEST 1: It’s bearable.</P>”;
if (($degrees > 100) && ($hot == “yes”)) {
echo “<P>TEST 2: It’s <strong>really</strong> hot!</P>”;
} else {
echo “<P> TEST 2: It’s bearable.</P>”;

About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

Leave a Reply

Your email address will not be published. Required fields are marked *