我有一个布尔变量,我想将其转换为字符串
$res = true;
Run Code Online (Sandbox Code Playgroud)
我需要它转换值也处于格式"true" "false"不"0" "1"
$converted_res = "true";
$converted_res = "false";
Run Code Online (Sandbox Code Playgroud)
我试过了:
$converted_res = string($res);
$converted_res = String($res);
Run Code Online (Sandbox Code Playgroud)
但它告诉我string并且String不是公认的功能.如何在php中将此布尔值转换为格式为"true"或"false"的字符串?