what is the difference between these two expressions ,
if(false == $flag)
if($flag == false)
what is the benefit of this expression rather than normal initiation like this :
if($flag == false)
what is the difference between these two expressions ,
if(false == $flag)
if($flag == false)
what is the benefit of this expression rather than normal initiation like this :
if($flag == false)
In first case, if(false == $flag)
, compiler warn you if you type accidentally =
instead of ==
. But this is not true in the second case, if($flag == false)
.
In second case if ==
is accidentally replaced by =
then compiler do not show you any warning or error instead $flag = false
will assign false
to flag
and the condition $flag = false
will always be false
.