А может человеку нужно что-то типа такого?
function str_ident($string, $char = \' \', $count = 4) {
$ident = str_repeat($char, $count);
return $ident.str_replace("\\n", "\\n".$ident, $string);
}
$input = file_get_contents(__FILE__);
$output = str_ident($input);
echo \'\'.htmlspecialchars($output).\'
\';