Tema: Preg_match
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/11/2011, 21:09
Avatar de LanbreGroteo
LanbreGroteo
 
Fecha de Ingreso: agosto-2009
Ubicación: $Mx->['Veracruz']
Mensajes: 69
Antigüedad: 15 años, 7 meses
Puntos: 1
Pregunta Respuesta: Preg_match

Código PHP:
public function check($type$value)
    {
        switch(
$type){
            case 
"al":
                if(
preg_match("/^[a-zA-Z0-9.-_]$/"$value)):
                    die();
                else:
                    
$this->_bind $value;
                    return 
$this->_bind;
                endif;
            break;
            
            case 
"s":
                if(
preg_match("/^[a-zA-Z.-_]$/"$value)):
                    die();
                else:
                    
$this->_bind $value;
                    return 
$this->_bind;
                endif;
            break;
            
            case 
"n":
                if(!
is_numeric($value) && ctype_digit($value)):
                    die();
                else:
                    
$this->_bind $value;
                    return 
$this->_bind;
                endif;
            break;
        }
    } 
Entonces... esto lo uso de esta manera
Código PHP:
$se->check('al''Usuario90'); 
pero, siempre me devuelve la cadena y no la checa. Si pongo: $se->check('n', 'Hola'); me sigue devolviendo la cadena y no me checa si es un número o dígito.

¿Por qué?
__________________
Et credo in Serpentem, mysterium mysteriorum. In nomen eius Baphomet