我有以下两个变量,它们的值完全相同:
$appointment->date->format('H:i') is equal to '13:00:00'
$hour->format('H:i') is equal to '13:00:00'
所以当我这样做
if($appointment->date->format('H:i') == $hour->format('H:i'))
{ $result = true} else { $result = false}
返回$ result true
我还有另外一对变量,它们的值完全相同:
$appointment->employee->user->firstname = 'Angela'
$employee->firstname == 'Angela'
同样,当我这样做时:
if($appointment->employee->user->firstname == $employee->firstname)
{ $result = true} else { $result = false}
变量$ results返回 true
因此,两个语句都返回TRUE
请注意,我使用的是 == ,而不是 === 但是现在,如果我这样做:
if($appointment->date->format('H:i') == $hour->format('H:i')
&&
$appointment->employee->user->firstname == $employee->firstname)
{ $result = true} else { $result = false}
变量$ result返回FALSE!
根据我的理解,如果两个陈述均正确,则应为:
TRUE & TRUE => TRUE
但是在这种情况下,我返回FALSE。为什么?