note 38921 added to function.nl2br

From: Date: Mon, 12 Jan 2004 11:42:01 +0000
Subject: note 38921 added to function.nl2br
Groups: php.notes 
Request: Send a blank email to php-notes+get-63345@lists.php.net to get a copy of this message
You might want to add another line to Junkie [Matt]'s function, to avoid any possible problems with windows-newlines (which are \r\n instead of just \n): <?php function nl2br($str) { $str = preg_replace('/\r\n/i', '<br />', $str); $str = preg_replace('/\n/i', '<br />', $str); return $str; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.nl2br.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38921 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38921&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38921&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63345) next »