Home  >  Article  >  Backend Development  >  What is the usage of !== not equal in php?

What is the usage of !== not equal in php?

WBOY
WBOYOriginal
2022-02-23 16:08:582311browse

In PHP, "!==" is not exactly equal, also called the absolute not equal operator. When the values ​​​​on both sides of the operator are not the same or the types are not the same, the returned result is "true", otherwise it returns "false" ", the syntax is "x !== y".

What is the usage of !== not equal in php?

The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer.

What is the usage of !== not exactly equal in php

Absolutely not equal If x is not equal to y, or their types are not the same, then return true

5!= ="5" returns true

The equal to operation process is as follows:

1. Determine whether the data types of the two sides of the equal to operator are the same. If they are not the same, return false

2. Determine whether the values ​​of the two sides of the equal operator are equal. If they are not equal, return false

3. Finally, perform the AND operation of the above two steps. Returns the result of the AND operation.

The operation process of not equal to equal (!==) is exactly the opposite of equal to equal:

1. Determine whether the data types of the two sides of the not equal to equal operator are the same. If they are not the same, return true

2. Determine whether the values ​​of the two sides of the not equal to operator are equal. If they are not equal, return true

3. Finally, perform the OR operation of the above 2 steps. Returns the result of an OR operation.

The example is as follows:

<?php
$x=100; 
$y="100";
var_dump($x !== $y);
echo "<br>";
?>

Output result:

What is the usage of !== not equal in php?

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What is the usage of !== not equal in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn