After studying this chapter you will be able to understand: PHP comparison operators, PHP conditional statements, PHP - The statement, the PHP switch statement, the PHP while loop, the PHP foreach loop,. | CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad Virtual Campus, CIIT COMSATS Institute of Information Technology T2-Lecture-10 PHP Part-II T2-Lecture-10 For Lecture Material/Slides Thanks to: PHP Comparison Operators The PHP comparison operators are used to compare two values (number or string): Operator Name Example Result == Equal $x == $y True if $x is equal to $y === Identical $x === $y True if $x is equal to $y, and they are of the same type != Not equal $x != $y True if $x is not equal to $y Not equal $x $y True if $x is not equal to $y !== Not identical $x !== $y True if $x is not equal to $y, or they are not of the same type > Greater than $x > $y True if $x is greater than $y = Greater than or equal to $x >= $y True if $x is greater than or equal to $y 1- Example of Comparison Operators "; var_dump($x === $y); echo ""; var_dump($x != $y); echo ""; var_dump($x !== $y); echo ""; $a=50; $b=90; var_dump($a > $b); echo ""; var_dump($a T2-Lecture-9 Ahmed Mumtaz Mustehsan 1- PHP Logical Operators Operator Name Example Result and And $x and $y True if both $x and $y are true or Or $x or $y True if either $x or $y is true xor Xor $x xor $y True if either $x or $y is true, but not both && And $x && $y True if both $x and $y are true || Or $x || $y True if either $x or $y is true ! Not !$x True if $x is not true T2-Lecture-9 Ahmed Mumtaz Mustehsan 1- PHP Array Operators The PHP array operators are used to compare arrays: Operator Name Example Result + Union $x + $y Union of $x and $y (but duplicate keys are not overwritten) == Equality $x == $y True if $x and $y have the same key/value pairs === Identity $x === $y . | CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad Virtual Campus, CIIT COMSATS Institute of Information Technology T2-Lecture-10 PHP Part-II T2-Lecture-10 For Lecture Material/Slides Thanks to: PHP Comparison Operators The PHP comparison operators are used to compare two values (number or string): Operator Name Example Result == Equal $x == $y True if $x is equal to $y === Identical $x === $y True if $x is equal to $y, and they are of the same type != Not equal $x != $y True if $x is not equal to $y Not equal $x $y True if $x is not equal to $y !== Not identical $x !== $y True if $x is not equal to $y, or they are not of the same type > Greater than $x > $y True if $x is greater than $y = Greater than or equal to $x >= $y True if $x is greater than or equal to $y <= Less than or equal to $x <= $y True if $x is less than or equal to $y T2-Lecture-9 Ahmed Mumtaz Mustehsan .