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!
精彩评论