How to Convert Boolean to String
Posted
by tag
on Stack Overflow
See other posts from Stack Overflow
or by tag
Published on 2010-05-08T18:28:37Z
Indexed on
2010/05/08
18:38 UTC
Read the original article
Hit count: 241
I have a boolean variable which I want to convert to a string
$res = true;
I need it the converted value to also be in the format "true" "false"
not "0" "1"
$converted_res = "true";
$converted_res = "false";
I've tried:
$converted_res = string($res);
$converted_res = String($res);
but it tells me string
and String
are not recognized functions. How do I convert this boolean to a string in the format "true" or "false" in php?
© Stack Overflow or respective owner