How to Convert Boolean to String
The function var_export returns a string representation of a variable, so you could do this:
var_export($res, true);
The second argument tells the function to return the string instead of echoing it.
Simplest solution:
$converted_res = $res ? 'true' : 'false';
Another way to do : json_encode( booleanValue )
echo json_encode(true); // string "true"
echo json_encode(false); // string "false"
// null !== false
echo json_encode(null); // string "null"