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

王林
Release: 2023-04-08 14:54:01
Original
3002 people have browsed it

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;  //为真
Copy after login

= means assignment.

For example:

$a=2;
$a=$q;
Copy after login

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!

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template