How to replace newline or \r\n with <br/>?
-
31-10-2019 - |
Pregunta
Trying to simply replace some new lines. Have tried 3 different ways and I get no change:
$description = preg_replace('/\r?\n|\r/','<br/>', $description);
$description = str_replace(array("\r\n","\r","\n"),"<br/>", $description);
$description = nl2br($description);
These should all work but I still get the newlines. They are double: "\r\r". That shouldn't make any of these fail right?
No hay solución correcta
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow