/** * Searches an array *(or even a multi-dimensional array)* using a regular expression match against array values. * * @package s2Member\Utilities * @since 3.5 * * @param str $regex A regular expression to look for inside the array. * @return bool True if the regular expression matched at least one value in the array, else false. */ public static function regex_in_array($regex = FALSE, $array = FALSE) { if (is_string($regex) && strlen($regex) && is_array($array)) { foreach ($array as $value) { if (is_array($value)) { if (c_ws_plugin__s2member_utils_arrays::regex_in_array($regex, $value)) { return true; } } else { if (is_string($value)) { if (@preg_match($regex, $value)) { return true; } } } } return false; } else { // False. return false; } }