6
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by rizvihaider72
0

That is an incorrect example

<?php
$a = 10;
$b = 5+5;
$c = '5+5';

var_dump($a);
var_dump($b);
var_dump($c);
var_dump($a == $b);
var_dump($a === $b);
var_dump($b === $c);
int 10
int 10
string '5+5' (length=3)
boolean true
boolean true
boolean false
0

in short what all others are trying to explain you is '==' only checks the contents of both the operands for equality and '===' compares for types (of both operands) too.

0

The difference between both of them is that :
"==" -> It only checks for equality without checking the datatype
"===" -> It checks for equality and also both the variables should be of same datatype

Edited by Ezzaral: Snipped url. Please restrict personal links to your user signature.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.