PHP Comparison Operators | Relational Operators in PHP - PHP Tutorial 27
1.4 هزار بار بازدید -
5 سال پیش
-
Notes for You:: PHP Relational
Notes for You:: PHP Relational Operators.
- are also known as comparison operators.
- are used to compare the relationship between two values;
- on comparison they yield the result true (1) or false (0).
< : less than
> : greater than
<= : less than or equal to
>= : greater than or equal to
== : equal to
=== : strictly equal to
!= : not equal to
<> : not equal to
!== : strictly not equal to
Example Code:
echo (3 < 4) ? "true" : "false", "<br/>"; // true
echo (4 < 3) ? "true" : "false", "<br/>"; // false
echo (4 > 3) ? "true" : "false", "<br/>"; // true
echo (4 > 5) ? "true" : "false", "<br/>"; // false
echo (5 <= 6) ? "true" : "false", "<br/>"; // true
echo (6 <= 6) ? "true" : "false", "<br/>"; // true
echo (7 <= 6) ? "true" : "false", "<br/>"; // false
echo (7 >= 6) ? "true" : "false", "<br/>"; // true
echo (7 >= 7) ? "true" : "false", "<br/>"; // true
echo (7 >= 8) ? "true" : "false", "<br/>"; // false
echo (9 == 9) ? "true" : "false", "<br/>"; // true
echo (9 == "9") ? "true" : "false", "<br/>"; // true
echo (9 === "9") ? "true" : "false", "<br/>"; // false
echo (9 != 9) ? "true" : "false", "<br/>"; // false
echo (9 != "9") ? "true" : "false", "<br/>"; // false
echo (9 !== "9") ? "true" : "false", "<br/>"; // true
echo (9 <> 10) ? "true" : "false", "<br/>"; // true
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
PHP Tutorial 28 - Logical Operators in PHP | PHP Boolean Operators Tutorial
PHP Boolean Operators | Logical Opera...
Follow the link for previous video:
PHP Tutorial 26 - Arithmetic Operators in PHP | PHP Arithmetic Operators Tutorial
PHP Arithmetic Operators | Arithmetic...
=========================================
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:-
#ChidresTechTutorials #PHP #PHPTutorial
- are also known as comparison operators.
- are used to compare the relationship between two values;
- on comparison they yield the result true (1) or false (0).
< : less than
> : greater than
<= : less than or equal to
>= : greater than or equal to
== : equal to
=== : strictly equal to
!= : not equal to
<> : not equal to
!== : strictly not equal to
Example Code:
echo (3 < 4) ? "true" : "false", "<br/>"; // true
echo (4 < 3) ? "true" : "false", "<br/>"; // false
echo (4 > 3) ? "true" : "false", "<br/>"; // true
echo (4 > 5) ? "true" : "false", "<br/>"; // false
echo (5 <= 6) ? "true" : "false", "<br/>"; // true
echo (6 <= 6) ? "true" : "false", "<br/>"; // true
echo (7 <= 6) ? "true" : "false", "<br/>"; // false
echo (7 >= 6) ? "true" : "false", "<br/>"; // true
echo (7 >= 7) ? "true" : "false", "<br/>"; // true
echo (7 >= 8) ? "true" : "false", "<br/>"; // false
echo (9 == 9) ? "true" : "false", "<br/>"; // true
echo (9 == "9") ? "true" : "false", "<br/>"; // true
echo (9 === "9") ? "true" : "false", "<br/>"; // false
echo (9 != 9) ? "true" : "false", "<br/>"; // false
echo (9 != "9") ? "true" : "false", "<br/>"; // false
echo (9 !== "9") ? "true" : "false", "<br/>"; // true
echo (9 <> 10) ? "true" : "false", "<br/>"; // true
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
PHP Tutorial 28 - Logical Operators in PHP | PHP Boolean Operators Tutorial
PHP Boolean Operators | Logical Opera...
Follow the link for previous video:
PHP Tutorial 26 - Arithmetic Operators in PHP | PHP Arithmetic Operators Tutorial
PHP Arithmetic Operators | Arithmetic...
=========================================
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:-
#ChidresTechTutorials #PHP #PHPTutorial
5 سال پیش
در تاریخ 1398/06/08 منتشر شده
است.
1,404
بـار بازدید شده