note 109848 deleted from function.nl2br by googleguy
| From: | googleguy@php.net | Date: | Thu, 13 Jun 2013 11:09:03 +0000 |
| Subject: | note 109848 deleted from function.nl2br by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-195169@lists.php.net to get a copy of this message | ||
Note Submitter: kadet1090 at gmail dot com
----
Deleting <br /> from pre block with class? No problem:
<?php
if(preg_match_all('/\<pre (.*?)\>(.*?)\<\/pre\>/', $sText, $match))
for($i = 0, $count = count($match[0]); $i < $count; $i++)
$sText = str_replace('<pre
'.$match[1][$i].'>'.$match[2][$i].'</pre>','<pre
'.$match[1][$i].'>'.str_replace('<br />', "\n",
$match[2][$i]).'</pre>', $sText);
?>