Tags
PHP
Asked 2025 years ago
30 Nov -0001
Views 174
Ceasar

Ceasar posted

What is the difference between == and === in php ?

using some where at code like this

if($check==1){
}
if($check===1){
}

i dont know where to use == and === in php ?
so What is the difference between == and === in php ?
dilip

dilip
answered Jul 21 '21 00:00

== is used to check the value
=== is used to check the value and type also

so if
$x='1';
$y=1;
$x===y is give false return because both have same value but $x and $y is different type , $x have string value and $y have int value and === check the value and type also .
$x==y is give true return because both have same value and == only check value not type
Post Answer