PHP Logical Operators - PHP Tutorial 28

Veröffentlicht am: 03 September 2019
auf dem Kanal: ChidresTechTutorials
1,506
20

Notes for You:: PHP Logical Operators - PHP Tutorial 28
- are also known as logical connectives.
- are used to connect one or more conditions.
- accept Boolean operands, on evaluation they yield the result true or false.

&& / and: Logical and Operator:
- If both LHS and RHS operands are true then the result will be true, in all other cases the result will be false.

|| / or: Logical or Operator:
- If both LHS and RHS operands are false then the result will be false, in all other cases the result will be true.

xor : Logical exclusive Or Operator:
- If both are same then the result will be false otherwise true.

!: Logical not Operator:
- If the given operand is false, then the result will be true. Vice versa.

Example code:
echo (true && true) ? "true" : "false", "<br/>"; // true
echo (true && false) ? "true" : "false", "<br/>"; // false
echo (false && true) ? "true" : "false", "<br/>"; // false
echo (false && false) ? "true" : "false", "<br/>"; // false
echo "<br/>";
echo (true || true) ? "true" : "false", "<br/>"; // true
echo (true || false) ? "true" : "false", "<br/>"; // true
echo (false || true) ? "true" : "false", "<br/>"; // true
echo (false || false) ? "true" : "false", "<br/>"; // false
echo "<br/>";
echo (true xor true) ? "true" : "false", "<br/>"; // false
echo (true xor false) ? "true" : "false", "<br/>"; // true
echo (false xor true) ? "true" : "false", "<br/>"; // true
echo (false xor false) ? "true" : "false", "<br/>"; // false
echo "<br/>";
echo (!true) ? "true" : "false","<br/>"; // false
echo (!false) ? "true" : "false","<br/>"; // true
echo "<br/>";

echo ((3<4) && (4<5)) ? "true" : "false","<br/>"; // true
echo ((3<4) and (4<5)) ? "true" : "false","<br/>"; // true
echo "<br/>";
echo ((3>4) || (4>5)) ? "true" : "false","<br/>"; // false
echo ((3>4) or (4>5)) ? "true" : "false","<br/>"; // false
echo "<br/>";
echo (!(3<4)) ? "true" : "false","<br/>"; // false

Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.

=========================================

Follow the link for next video:
PHP Tutorial 29 - Conditional Operator in PHP | PHP Ternary Operator Tutorial
   • PHP Conditional Operator - PHP Tutori...  

Follow the link for previous video:
PHP Tutorial 27 - Relational Operators in PHP | PHP Comparison Operators Tutorial
   • PHP Relational Operators - PHP Tutori...  

=========================================

PHP Tutorials Playlist:-
   • PHP Tutorials  

=========================================
Watch My Other Useful Tutorials:-

MySQL Tutorials Playlist:-
   • MySQL Tutorials  

HTML Tutorials Playlist:-
   • HTML Tutorials  

CSS Tutorials Playlist:-
   • CSS Tutorials  

JavaScript Tutorials Playlist:-
   • JavaScript Tutorials  

=========================================

Subscribe to our YouTube channel:
   / chidrestechtutorials  

Visit our Website:
https://www.chidrestechtutorials.com

=========================================
Hash Tags:
#PHP #PHPTutorial #ChidresTechTutorials


Auf dieser Seite können Sie das Online-Video PHP Logical Operators - PHP Tutorial 28 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer ChidresTechTutorials 03 September 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,506 Mal angesehen und es wurde von 20 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!