So, I have a bunch of code that I\'m pulling from a column in MySQL. This code includes hidden characters, such as \"\\t\" and \"\\n\".
I\'m trying to get that raw c
Add shlashes and preserve newline ;)
// Simple example: replace all newlines with their character equivalent
// AND preserve formating (the newline)
$value = str_replace("\n", "\\n\n", $value);
$value = str_replace("\t", "\\t\t", $value);
echo nl2br(htmlentities($value)); // for HTML as output, with
for newlines
echo "" . $value . "
"; // for raw, preformated output
if you have
$value = "Hi\t\n there";
the result is
hi\t \n
there
for the html output line.