Home > Backend Development > PHP Tutorial > What does === mean in php

What does === mean in php

下次还敢
Release: 2024-04-27 12:03:30
Original
830 people have browsed it

The === operator in PHP is used to compare whether the values ​​and types of two expressions are exactly equal. It returns true if both values ​​and types are equal, otherwise it returns false.

What does === mean in php

=== operator in PHP

In PHP, ===## The # operator is a strict equality operator that compares the values ​​and types of two expressions.

Usage:

=== operator is used to check whether the values ​​and types of two expressions are completely equal. Returns true if and only if both expressions are equal in value and type. Otherwise, returns false.

Grammar:

<code class="php">$result = ($expression1 === $expression2);</code>
Copy after login

Example:

<code class="php">$a = 10;
$b = 10;
$c = "10";

var_dump($a === $b); // true
var_dump($b === $c); // false
var_dump($c === $a); // false</code>
Copy after login

Note:

  • === is different from the == operator. == only compares values, while === compares values ​​and types.
  • === Comparisons are less reliable for floating point numbers, which may contain rounding errors.

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

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template