Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home1/tylerfra/public_html/includes/common.inc).

PHP Split String by Comma and New Line Characters

Category: 
Tags: 

Use this handy PHP snippet to split a string by commas and new line characters.

// Replace all the new lines with commas, then split (explode) by comma to get each part of the string.
$input = $my_string_with_commas_and_new_lines;
$input = preg_replace("/((\r?\n)|(\r\n?))/", ',', $input);
$pieces = explode(',', $input);
foreach($pieces as $part) {
  print($part);
}

There you have it, tride and true, just for you.