Tema: ayuda!
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/02/2011, 11:10
inesbara1
 
Fecha de Ingreso: febrero-2011
Mensajes: 4
Antigüedad: 13 años, 2 meses
Puntos: 0
ayuda!

Hola soy nueva en foros del web buscando por aqui me encontre esta funcion para validar email:
Código PHP:
Ver original
  1. /**
  2.  * Validar E-mail
  3.  *
  4.  * @param  string  $text  Cadena
  5.  * @param  boolean $multi Emails multiples?
  6.  * @param  boolean $check Emplear checkdnsrr()?
  7.  * @return boolean
  8.  */
  9. function is_email($text, $multi = FALSE, $check = FALSE)
  10. {
  11.     static $expr = '/^([\w\+\-:]+)(\.[\w\+\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/i';
  12.     $text = preg_split('/[,;\|]+/', (string) $text);
  13.  
  14.     if ( ! $multi && (sizeof($text) > 1)) return FALSE;
  15.     elseif (empty($text)) return FALSE;
  16.  
  17.     foreach ($text as $value)
  18.     {
  19.         if ( ! preg_match($expr, $value)) return FALSE;
  20.         elseif ($check === TRUE && ! checkdnsrr(substr($value, strpos($value, '@') +1), 'MX')) return FALSE;
  21.     }
  22.     return TRUE;
  23. }

como podria utlizar esta funcion para validar varios email

e probado haciendo esto:
Código PHP:
Ver original
  1.  
  2. if(is_email($email,true,true)){
  3. echo"valido";
  4. }else{
  5. echo"no valido";
  6. }

pero siempre me da no valido aunque las direcciones esten buenas.

ayuda plis.