Ver Mensaje Individual
  #5 (permalink)  
Antiguo 09/03/2011, 11:16
cambalachito
 
Fecha de Ingreso: febrero-2009
Mensajes: 56
Antigüedad: 16 años
Puntos: 3
Respuesta: CUál es mejor usar ???

Resultados: (Hice un pequeño Script para probar)

Lo comparto !!

Código PHP:
<?php
$email 
"[email protected]";
$patron "/^\S+@[\w\d.-]{2,}\.[\w]{2,6}$/iU";
$tiempo_inicial microtime(true);

    if(
filter_var($emailFILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>$patron))) == true)
    {
        
$tiempo_filtro microtime(true) - $tiempo_inicial;
        echo 
number_format($tiempo_filtro6'.''').' > Utilizando FILTER_VAR<br><br>';
    }
    
    if (
preg_match($patron$email) == true)
    {
        
$tiempo_preg_match microtime(true) - $tiempo_inicial;
        echo 
number_format($tiempo_preg_match6'.''').' > Utilizando PREG_MATCH<br><br><br>';
    }
    
    echo 
'<strong>Conclusion</strong>: Utilizando FILTER VAR se validan las Expresiones Regulares m&aacute;s R&aacute;pido !!';
?>

Filter_var es el Ganador !!!