为什么PHP不打印TRUE/FALSE? [英] Why doesn't PHP print TRUE/FALSE?

查看:296
本文介绍了为什么PHP不打印TRUE/FALSE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
PHP-使布尔在错误时回显错误

Possible Duplicate:
PHP - Get bool to echo false when false

给出以下test.php:

Given the following test.php:

<?php

echo TRUE . "\n";    // prints "1\n"
echo FALSE . "\n";   // prints "\n"

?>

为什么php -f test.php不打印TRUEFALSE?更重要的是,在FALSE情况下,为什么它不打印任何内容?

Why doesn't php -f test.php print TRUE or FALSE? More importantly, in the FALSE case, why doesn't it print anything?

推荐答案

来自手册 :

布尔TRUE值将转换为字符串"1".布尔值FALSE将转换为"(空字符串).这样可以在布尔值和字符串值之间来回转换.

A boolean TRUE value is converted to the string "1". Boolean FALSE is converted to "" (the empty string). This allows conversion back and forth between boolean and string values.

这篇关于为什么PHP不打印TRUE/FALSE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆