php中返回的是Integer而不是boolean


Integer is returned instead of boolean in php

我希望你做得很好。我在我的项目中有一节课,课上有各种方法。实际情况是,其中一个方法应该返回一个布尔变量。相反它返回了数字"1"而不是false。如果你能告诉我问题出在哪里。
提前谢谢,干杯。我的代码中有用的部分:
分类方法:

public function validatePwd($pwd1, $pwd2) {
    if (strcasecmp($pwd1, $pwd2) == 0) 
    {
        return true;
    }
    else 
    {
        return false;
    }
}

执行它的脚本:

$check1 = $user->validatePwd($Password, $Password1);
    echo $check1;
    if ($user->validatePwd($Password, $Password1)) 
    {
    }
    else
    {
       $errors[] = 'Error!, passwords entered are not compatible, Please'
               . ' enter passwords that match each other'; 
    }

如果使用var_dump($check1)而不是echo $check1;,它应该显示为布尔值。