How can I show these characters on a webpage?
Asked
Active
Viewed 7,372 times
2
-
Can you be a little more specific? How do you intent to show them? You're talking about actually having these characters in your text and translating or converting them into something that shows visually? – GalacticCowboy Feb 18 '10 at 14:08
2 Answers
3
// An example to replace all newlines with their character equivalent
$value = preg_replace('/[\r\n]+/', '\n', $value);
echo htmlentities($value);

Yada
- 30,349
- 24
- 103
- 144
0
Can you not do the following...
<?php
echo "\n"."\n";
echo "\0"."\n";
echo "\t"."\n";
echo "\x0B"."\n";
echo "\r"."\n";
?>
Expected Result:
\n
\0
\t
\x0B
\r
and that should just print to screen, since \
is the reference for a \
on web pages.
EDIT:
Looks like StackOverflow auto-changes \
to a \ when not marked as code!

Urda
- 5,460
- 5
- 34
- 47