Home  >  Article  >  Backend Development  >  Introduction to the differences between =, == and === in php

Introduction to the differences between =, == and === in php

王林
王林Original
2020-04-25 11:49:263013browse

Introduction to the differences between =, == and === in php

===Compares the values ​​and types of two variables; ==Compares the values ​​of two variables, but does not compare data types.

For example:

$a = '123';
$b = 123;
$a === $b;  //为假
$a == $b;  //为真

= means assignment.

For example:

$a=2;
$a=$q;

At this time, whether you echo $a or echo $q, it will output 2.

For more related tutorials, please pay attention to php中文网.

The above is the detailed content of Introduction to the differences between =, == and === 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