!== Operator: It is called as non-identical operator. It returns true if operands are not equal, or they are not of the same type.
Syntax:
$x !== $y
Where $x and $y are the operands.
==! Operator: It is nothing but it can be further written as ==(!operand) which returns true or false depending on operands. Both the operators returns the boolean values either true or false.
Syntax:
$x ==! $y
Examples:
Input: $x = true
$y = false
Operator: $x !== $y
Output: true
Operator: $x ==! $y
Output: true
Example 1: This program uses both operands and returns the output.
<?php // PHP program to demonstrate // !== and ==! operator // Declare variables $x = true; $y = false; $z = true; // Using !== operator echo "Using !== operator\n"; // Is $x not equals to $y // so true returned var_dump($x !== $y); // Is $x not equals to $z // so false returned var_dump($x !== $z); // Is $y not equals to $z // so true returned var_dump($y !== $z); // Using ==! operator echo "\nUsing ==! operator\n"; // Is $x equals to (!$y) // so true returned var_dump($x ==! $y); // Is $x equals to (!$z) // so false returned var_dump($x ==! $z); // Is $y equals to (!$z) // so true returned var_dump($y ==! $z); ?> |
Using !== operator bool(true) bool(false) bool(true) Using ==! operator bool(true) bool(false) bool(true)
Program 2:
<?php // PHP program to demonstrate // !== and ==! operator // Dsclare associative array $x = array( "1" => "Geeks", "2" => "for", "3" => "Geeks"); $y = array( "5" => "Tony", "6" => "Captain", "7" => "Thor"); // Union of $x and $y $z = $x + $y; // Using !== operator echo "Using !== operator\n"; // Is $x not equals to $y // so true returned var_dump($x !== $y); // Is $x not equals to $z // so true returned var_dump($x !== $z); // Is $y not equals to $z // so true returned var_dump($y !== $z); // Using ==! operator echo "\nUsing ==! operator\n"; // Is $x equals to (!$y) // so false returned var_dump($x ==! $y); // Is $x equals to (!$z) // so false returned var_dump($x ==! $z); // Is $y equals to (!$z) // so false returned var_dump($y ==! $z); ?> |
Using !== operator bool(true) bool(true) bool(true) Using ==! operator bool(false) bool(false) bool(false)
Recommended Posts:
- Difference and Similarities between PHP and C
- Difference between JavaScript and Php
- Difference between try-catch and if-else statements in PHP
- Difference between isset() and array_key_exists() Function in PHP
- Difference between bindParam and bindValue in PHP
- What is the difference between the | and || or operator in php?
- What is the difference between public, private, and protected in PHP?
- Difference between require-dev and require in PHP?
- What is the difference between HTTP_HOST and SERVER_NAME in PHP?
- What is the difference between is_a() function and instanceof in PHP?
- What is the difference between echo, print, and print_r in PHP?
- What is the difference between array_merge and array + array in PHP?
- What is the difference between a language construct and a “built-in” function in PHP ?
- Difference between array() and [] in PHP
- What is the difference between single-quoted and double-quoted strings in PHP?
- Difference between break and continue in PHP
- What is the difference between Perl and PHP ?
- Difference Between JSP and PHP
- What is the difference between fopen modes “r+”, "rw+" and “w+” in PHP?
- Difference Between “php artisan dump-autoload” and “composer dump-autoload”
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

