Created
August 21, 2019 12:51
-
-
Save lonalore/2bf862edb89de797758840d1cf55fd91 to your computer and use it in GitHub Desktop.
Convert BR tags to newlines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert BR tags to newlines and carriage returns. | |
* | |
* @param string $string | |
* The string to convert | |
* | |
* @return string | |
* The converted string | |
*/ | |
function br2nl($string) { | |
return preg_replace('/\<br(\s*)?\/?\>/i', PHP_EOL, $string); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment