Note that in PHP, “string” and “string” are actually the same.
htmlentities () simply converts quotation marks and other special characters to their HTML entity equivalent. See this page.
Eliminate your slashes and (optionally) attach the code you want to show, as shown in the "pre" tags. Preliminary tags are not needed, but can help in readability.
Here is the code I tested:
<?php // Simple example: replace all newlines with their character equivalent // you will also need to do this for any other special characters as well $value = "\n"; $value = str_replace("\n", "\\n", $value); $value = "<pre>".$value."</pre>"; echo $value; ?>
shady source share