note 116001 deleted from function.nl2br by salathe
| From: | salathe@php.net | Date: | Fri, 07 Nov 2014 10:20:11 +0000 |
| Subject: | note 116001 deleted from function.nl2br by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200806@lists.php.net to get a copy of this message | ||
Note Submitter: Suleman Chikhalia
----
Looking for the reverse of the nl2br function? Here is a more succinct way to convert HTML line
breaks to newlines (making a slight improvement to http://php.net/nl2br#86678):
<?php
/**
* Convert HTML line breaks to newlines
*
* @param string The string to convert
* @return string The converted string
*/
function br2nl($string)
{
return preg_replace('/<br\s*\/?>/i', "\n", $string);
}
?>