打印在PHP假 [英] Print false in php
本文介绍了打印在PHP假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打印以下语句:
print false . "\n" . true . "\n";
echo false . (bool)false . "\n" . true . "\n";
print "0" . "\n" . true . "\n";
这是我得到的结果是只是1 1 0 1。
预期的结果是:
The result that I am getting is just "1 1 0 1". The expected result is:
0结果
1结果
0结果
1结果
0结果
1
0
1
0
1
0
1
我使用PHP 5.4.3 MSVC9 64
可有人请解释为什么,我怎么可以把它打印正确的方法是什么?
I am using PHP 5.4.3 MSVC9 x64 Can someone please explain why and how I can make it print the correct way?
推荐答案
这应该做的伎俩。使用数组。
This should do the trick. Use an array.
$boolarray = Array(false => 'false', true => 'true');
echo $boolarray[false]," ", $boolarray[true];
输出:假真
这篇关于打印在PHP假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文