I want to create my personal blog and to be able to put code in pre tags. I have created some functions for converting content for and from database.
Basicaly the idea is tha same as
but this is not working in my pc. The created functions work on localhost(win7) but didn't work in my linux box(debian server)
//$s = str_replace("'", "\'", $s ); // i don't need this since mysql auto escape single quotes (can't find and turn it off)
// $s = str_replace("\'", "'", $s ); // alse not needed
// $s = str_replace("<pre>", "<pre>", $s );
// $s = str_replace("</pre>", "</pre>", $s );
$s = preg_replace_callback(
$s = nl2br($s);
I think it is clear from the function names waht they do.
The problem is that when save & lt; on database it appear < on my edit window and when I edit once an article all entities are converted in tags.
Here is the result