You are here

function reroute_email_split_string in Reroute Email 8

Same name and namespace in other branches
  1. 7 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_update_8001 in ./reroute_email.install
Implements hook_update_N().
SettingsForm::validateFormEmails in src/Form/SettingsForm.php
Validate multiple email addresses field.

File

./reroute_email.module, line 285
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;
}