如何将布尔值转换为字符串
我有一个布尔变量,我想将其转换为字符串:
$res = true;
我需要转换后的值的格式为:,而不是"true" "false"
"0" "1"
$converted_res = "true";
$converted_res = "false";
我试过了:
$converted_res = string($res);
$converted_res = String($res);
但它告诉我,并且不是公认的功能。
如何将此布尔值转换为PHP格式或PHP格式的字符串?string
String
"true"
"false"