miércoles, 8 de junio de 2016

PHP - ver si un string contiene un caracter

cómo ver si una cadena ó string contiene un caracter? strpos()

$dirPai = htmlspecialchars($_REQUEST["dirPai"] );
if (strpos($dirPro, '-') !== false) {
 if (phpversion () < "5"){
  list($idPais, $nomPais) = split('[/.-]', $dirPai);
 }else{
  list($idPais, $nomPais) = explode('-', $dirPai);
 }
}else{
 $nomPai = $dirPai;
}

No hay comentarios:

Publicar un comentario