comparing two variables returns false result

后端 未结 5 1076
感情败类
感情败类 2021-01-25 13:27

Why does this always return true:

$s = \'334rr\';
$i = (int)$s;

if ($i == $s) {
    echo true;
} else {
    echo false;
}

If I ec

5条回答
  •  暖寄归人
    2021-01-25 14:06

    When compare string with integer using ==, string will try to case into integer.

提交回复
热议问题