note 124560 added to function.nl2br

From: Date: Thu, 02 Jan 2020 23:57:55 +0000
Subject: note 124560 added to function.nl2br
Groups: php.notes 
Request: Send a blank email to php-notes+get-213723@lists.php.net to get a copy of this message
Let's say a form text field does contain: test line number 1 test line number 2 To remove all the line breaks and split the input into an array: $input_from_text_field = preg_replace('#[\r\n]#','',nl2br($input_from_text_field,false)); $lines = explode("<br>",$input_from_text_field); $lines will now be an array where $lines[0] = "test line number 1" and so on. ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.195 (proxied: 80.101.210.33) ---- Manual Page -- http://php.net/manual/en/function.nl2br.php Edit -- https://master.php.net/note/edit/124560 Del: integrated -- https://master.php.net/note/delete/124560/integrated Del: useless -- https://master.php.net/note/delete/124560/useless Del: bad code -- https://master.php.net/note/delete/124560/bad+code Del: spam -- https://master.php.net/note/delete/124560/spam Del: non-english -- https://master.php.net/note/delete/124560/non-english Del: in docs -- https://master.php.net/note/delete/124560/in+docs Del: other reasons-- https://master.php.net/note/delete/124560 Reject -- https://master.php.net/note/reject/124560 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#213723) next »