LMSouq
php-dev Open

How to Convert Boolean to String

TA
tag
1 month ago
3 views
Problem Description
I have a Boolean variable which I want to convert to a string: $res = true; I need the converted value to be of the format: `"true" "false"`, not `"0" "1"` $converted_res = "true"; $converted_res = "false"; I've tried: $converted_res = string($res); $converted_res = String($res); But it tells me that `string` and `String` are not recognized functions. How do I convert this Boolean to a string in the format of `"true"` or `"false"` in PHP?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base