PHP boolean to string with modification & a condition

mtawer

New Member
When \[code\]echo\[/code\]ing a boolean (true or false), PHP converts it to \[code\]1\[/code\] or \[code\]<nothing>\[/code\] and displays it. e.g.:\[code\]$x = true; echo $x; //displays: 1$x = false; echo $x; //displays: <nothing>\[/code\]My Question: Is there a PHP function (if not how to code it) which can display exactly "true" or "false" (and not 1 or nothing), if a variable is a boolean otherwise just display as PHP would normally display it.
 
Back
Top