PHP - Get bool to echo false when false

前端 未结 14 1678
予麋鹿
予麋鹿 2020-11-22 14:09

The following code doesn\'t print out anything:

$bool_val = (bool)false;
echo $bool_val;

But the following code prints 1:

14条回答
  •  情歌与酒
    2020-11-22 14:43

    This will print out boolean value as it is, instead of 1/0.

        $bool = false;
    
        echo json_encode($bool);   //false
    

提交回复
热议问题