Adding a line break as separator
<p>I have a function that uses comma as separator in breaking name/email pairs from a long string. I would like to modify this function to be able to detect if instead of a comma a line break is used. Here's the function that needs to be modified:</p>

<pre><code>$str = '"Fname Lname" &lt;abc@email.com&gt;, abc@gmail.com';
$pairs = explode( ",", $str );
foreach( $pairs as $pair ) {
  if( strpos($pair, '&lt;') ) {
    $output = explode( "&lt;", $pair );
    $output['0'] = trim( str_replace( "\"", "", $output['0'] ) );
    $output['1'] = trim( rtrim( $output['1'], "&gt;" ) );
  } else {
    $output = array();
    $output['0'] = '';
    $output['1'] = $pair;
  }
  print_r($output); // Save it to database here
}
</code></pre>

<p>I found a post suggesting using a file() fnction but I am not sure how to combine those two together.</p>

<pre><code>$str = '"Fname Lname" &lt;abc@email.com&gt;, abc@gmail.com';
$pairs = file($str, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); 
</code></pre>
