开发者

Printing booleans in php

Is there something ready开发者_如何学运维 for printing Booleans in PHP (usually for debug), rather than writing: echo ($flag ? "true" : "false") every time?


var_export($flag);


$a = TRUE;
var_dump($a); // bool(true)


http://php.net/manual/en/language.types.string.php

A boolean TRUE value is converted to the string "1". Boolean FALSE is converted to "" (the empty string).

Your current method is probably the easiest method without calling a function.


You could write a little function - that would save chars and typing!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜