for ($i=0;$i < $pcount;$i++) $text = preg_replace('#\[pre\](.*?)\[/pre\]#si', '
\1
', $text);