Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

Line break in a textarea and create array using php

by
Category:php
php php function php string
Line break in a textarea and create array using php

To add line breaks in html we have to use tags but to add this line break to any text entry from a form or from a text area we have to use the function nl2br() in PHP. This function nl2br() searches for all the line breaks or carriage returns within a string and replace them with line break tag or tag. This way we can automatically add line breaks for a web page inside a string after break line and use explode function and create array. You may also like Line breaks in a textarea using php and Read text file draw line between two points google map API using javascript.

PHP Code

$Item           = $_POST['item'];
$getitem        = nl2br($Item);
$haystack       = explode('<br />',$getitem);
$trimmed_array  = array_map('trim',$haystack);

0 Comments


Html code work in comment box


Related Post