[thelist] PHP - str_replace problem
Chris Ditty
cditty at gmail.com
Tue Oct 19 22:29:04 CDT 2004
Hi all. I'm trying to do a little code snippets page for a site I am
working on. I figured it would be simple enough. I would do a
str_replace and replace the various html codes with the ascii
eqivulant. Unfortunately, it is not working as expected. Can anyone
help with this?
This is what I am using.
$snippetCode = str_replace("\n", "<br>", $snippet['snippetCode']);
$snippetCode = str_replace("<", ">", $snippetCode);
$snippetCode = str_replace(">", "<", $snippetCode);
$snippetCode = str_replace("&", "&", $snippetCode);
This is what is in $snippet['snippetCode'].
?><pre><? print_r($ArrayName); ?></pre><?
This is what is showing on the web page.
?<>pre<>? print_r($ArrayName); ?<>/pre<>?
If anyone can help, it would be appreciated. Also, if you have a
quick and dirty code colorer, I would appreciate that.
Thanks
Chris
More information about the thelist
mailing list