You are here

function reroute_email_split_string in Reroute Email 7

Same name and namespace in other branches
  1. 8 reroute_email.module \reroute_email_split_string()
  2. 2.x reroute_email.module \reroute_email_split_string()

Split a string into an array by pre defined allowed delimiters.

Items may be separated by any number and combination of: spaces, commas, semicolons, or newlines.

Parameters

string $string: A string to be split into an array.

Return value

array An array of unique values from a string.

3 calls to reroute_email_split_string()
reroute_email_check in ./reroute_email.module
Helper function to determine a need to reroute.
reroute_email_element_validate_addresses in ./reroute_email.module
Validate multiple email addresses field.
reroute_email_update_7001 in ./reroute_email.install
Implements hook_update_N().

File

./reroute_email.module, line 315
Intercepts all outgoing emails to be rerouted to a configurable destination.

Code

function reroute_email_split_string($string) {
  $array = preg_split('/[\\s,;\\n]+/', $string, -1, PREG_SPLIT_NO_EMPTY);

  // Remove duplications.
  $array = array_unique($array);
  return $array;
}