note 73440 added to function.nl2br

From: Date: Fri, 23 Feb 2007 12:12:40 +0000
Subject: note 73440 added to function.nl2br
Groups: php.notes 
Request: Send a blank email to php-notes+get-123739@lists.php.net to get a copy of this message
to replace all linebreaks to <br /> the best solution (IMO) is: function nl2br2($string) { $string = str_replace(array("\r\n", "\r", "\n"), "<br />", $string); return $string; } because each OS have different ASCII chars for linebreak: windows = \r\n unix = \n mac = \r works perfect for me ---- Server IP: 216.194.113.175 Probable Submitter: 210.193.6.54 (proxied: 202.152.240.215) ---- Manual Page -- http://www.php.net/manual/en/function.nl2br.php Edit -- https://master.php.net/note/edit/73440 Del: integrated -- https://master.php.net/note/delete/73440/integrated Del: useless -- https://master.php.net/note/delete/73440/useless Del: bad code -- https://master.php.net/note/delete/73440/bad+code Del: spam -- https://master.php.net/note/delete/73440/spam Del: non-english -- https://master.php.net/note/delete/73440/non-english Del: in docs -- https://master.php.net/note/delete/73440/in+docs Del: other reasons-- https://master.php.net/note/delete/73440 Reject -- https://master.php.net/note/reject/73440 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123739) next »