3 different equals
P粉134288794
P粉134288794 2024-03-19 16:18:10
0
2
323
What is the difference between

=, ==, ===?

I think using one equal sign is to declare a variable, two equal signs are used to compare conditions, and the last three equal signs are used to compare the value of the declared variable.

P粉134288794
P粉134288794

reply all(2)
P粉545956597
  • = is the assignment operator
  • ==代码> is a comparison operator (checks if Both variables have the same value)
  • === is the same comparison operator (checks whether two variables have the same value and are the same type).
P粉899950720

You have = assignment operator , == "equals" comparison operator and === "Same" comparison operator.

$a = $b Assign Sets $a to be equal to $b.
$a == $b Equal TRUE if $a is equal to $b.
$a === $b Identical TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)

For more information on the necessity of == and === and their respective usage, see Documentation.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!