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