Text Area Values into Array in PHP

Share this Article :


If you  want  to split up  the total text area content  into  array  based on the  row ,  Here is simple solution  to convert  textarea  field  value into  array in PHP.

$total=$_POST["textarea"]
 
$keyarr=explode("\n",$total);
// In order to  process this  array  values  here is the code 
 
foreach($keyarr  as  $key=>$value)
{
   //  becareful to check the value for  empty line 
   $value=trim($value);
   if  (!empty($value))
   {
        // Carry out your  own operations 
   }
}

Written by adrevol

{adrevol has written 91 posts on ITTreats.com . See all posts by }


Leave a Reply