Cast boolean to string PHP

> Convert boolean to string

Description
Cast bool to string


$bool = true;
$val = ($bool) ? 'true' : 'false'; // "true"
$val = json_encode(true);  // "true"
$val = json_encode(false); // "false" 

SEE ALSO