Skip to content

Instantly share code, notes, and snippets.

@kemo
Created May 19, 2011 08:35
Show Gist options
  • Save kemo/980407 to your computer and use it in GitHub Desktop.
Save kemo/980407 to your computer and use it in GitHub Desktop.
<?php defined('SYSPATH') or die('No direct script access.');
class Text extends Kohana_Text {
public static function extract_emails($string)
{
$return = array();
if (Valid::email($string))
{
$return[] = $string;
}
else
{
$exploded = explode(',', $string);
foreach ($exploded as $e)
{
$e = trim($e, "\n\t \"'");
if (Valid::email($e))
{
$return[] = $e;
}
}
}
return $return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment