Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the three equal signs of php

Shulou Source: shulou.com Published: 2022-06-01 06:01:35 10月04日 Update

This article introduces the relevant knowledge of "how to use the three equal signs of php". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

In php, the three equal signs "===" are congruent comparison operators that compare the values of two operands for equality and detect whether they are of the same type; the result is TRUE only if both values and data types are equal.

Operating environment of this tutorial: Windows 7 system, PHP7.1 version, DELL G3 computer

In php, the three equal signs "===" are congruent comparison operators.

Operator Name Description === congruence Compares the values of two operands for equality and detects whether they are of the same type

The identity (===) operator makes a strict comparison between given variables or values; it compares not only the values of the expressions on both sides of the operator, but also the data types, and the result is TRUE only if the values and data types on both sides are equal.

Note: In the example above,$ x and $ y have equal values but different data types, so they return false and execute the else part.

Extended information: PHP comparison operators

Example Name Description $a == $b = TRUE if the values of $a and $b are equal after type conversion, otherwise FALSE$a === $b congruent TRUE if $a and $b are not only equal in value, but also equal in type, otherwise FALSE$a != $b is not equal to TRUE if the value of $a is not equal to the value of $b after type conversion, otherwise FALSE$a $b is not equal to and!= Same, returns TRUE if the value of $a is not equal to the value of $b after type conversion, otherwise returns FALSE$a !== $b not congruent Returns TRUE if the value of $a is not equal to the value of $b, or if they are of different types; otherwise returns FALSE$a

< $b小与如果 $a 的值小于 $b 的值,则返回 TRUE,否则返回 FALSE$a >

$b is greater than $b Returns TRUE if the value of $a is greater than $b, otherwise returns FALSE$a = $b is greater than or equal to $b Returns TRUE if the value of $a is greater than or equal to $b, otherwise returns FALSE$a $b Spacecraft operator (combinatorial comparator) Returns an integer value less than, equal to, and greater than 0 when $a is less than, equal to, and greater than $b, respectively. PHP7 starts offering.$ a ?? $b ?? $cNULL Merge operator The first operand from left to right that exists and is not NULL. If neither is defined and is not NULL, NULL is returned. PHP7 is available now.

"How to use the three equal signs of php" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Tags: Type operation operator three equal sign data same variable Operand different two example content only at the same time name more knowledge result detection Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS MySQL Microsoft Shulou Technology