Forum Moderators: coopster
$a=1;
$b=1;
// Normal If{}
if($a==$b)
{
$result="EQUAL";
echo $result;
}
// Compact If{}
$result = $a==$b ? "EQUAL" : "NOT EQUAL";
echo $result;
So we are saying, if a==b then result is "EQUAL" otherwise the result is "NOT EQUAL";
Read it like
L.Hand Side = Condition ? "VALUE IF CONDITION RESULTS TRUE" : "VALUE IF CONDITION RESULTS FALSE"
[edited by: Anyango at 5:15 pm (utc) on Dec. 5, 2008]