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