Logical operators (AND, OR, NOT) in (IF, THEN) for JS and PHP
Logical operators AND, OR, NO for JS
Logical operators AND for JS – &&
if (true && true) document.write("It works!<br>");
Logical operators OR for JS – ||
if (true || false) document.write("It works!<br>");
Logical operators NO for JS- !
if (!false) document.write("It works!<br>");
Logical operators AND, OR, NO for PHP
Logical operators AND for PHP
IF (true AND true) echo "It works!"; IF (true && true) echo "It works!";
Logical operators OR for PHP
IF (true OR false) echo "It works!"; IF (true || false) echo "It works!";
Logical operators NO for PHP
IF ( !false ) echo "It works!";
Additional Information
Ternary operator if.
let result = condition ? value1 : value2; let accessAllowed = (age > 18) ? true : false;
<?php $min = ($foo < $bar) ? $foo : $bar; ?>
Zero, empty quotes, NULL for the Java programming language Script and PHP are FALSE.
var a = 0; //false var b = ""; //false var c = null; //false if ( !a ) document.write("It false!<br>");
Comparison Operators
$i == $y //equally $i === $y //is equal and has the same data type $i != $y //not equal $i <> $y //not equal $i !== $y //not equal or are they of different types $i < $y //smaller $i > $y //more $i <= $y //less or equal $i >= $y //more or equal
Categories: