The following code doesn\'t print out anything:
$bool_val = (bool)false; echo $bool_val;
But the following code prints 1:
1
json_encode will do it out-of-the-box, but it's not pretty (indented, etc):
echo json_encode(array('whatever' => TRUE, 'somethingelse' => FALSE));
...gives...
{"whatever":true,"somethingelse":false}