I have a feeling the answer is \"it\'s not possible,\" but thought I\'d ask to satisfy my curiosity.
I have some code that\'s echoed where the \\n is unavoidable:
<
If you wanted to be able to do it for anything you could use the output buffer:
ob_start();
echo "Hello\n World";
$out = ob_get_contents();
ob_end_clear();
echo str_replace('\n', '', $out);
You could even use httaccess to append scripts containing this to any script called.
However, couldn't you just deal with it before it is set to stdout? Like
function print2($str){
echo str_replace("\n", '', $str);
}