php convert bool to 1 or 0 code example Example: php boolean to string $converted_res = $res ? 'true' : 'false';