最佳答案
我有一个布尔变量,我想转换成一个字符串:
$res = true;
我需要转换的值的格式为:"true" "false",而不是"0" "1"
$converted_res = "true";
$converted_res = "false";
我试过了:
$converted_res = string($res);
$converted_res = String($res);
但是它告诉我string和String不是被识别的函数
如何将这个布尔值转换为PHP中的"true"或"false"格式的字符串?< / p >