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