note 63308 deleted from function.htmlspecialchars by nlopess
| From: | nlopess@php.net | Date: | Sun, 19 Mar 2006 10:32:55 +0000 |
| Subject: | note 63308 deleted from function.htmlspecialchars by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106070@lists.php.net to get a copy of this message | ||
Note Submitter: systemlard at gmail dot com
----
Aquà un error presentado en un foro español:
if($enviar) {
include("config.php") ;
function quitar($texto) {
$texto = trim($texto) ;
$texto = htmlspecialchars($texto) ;
$texto = str_replace(chr(160),'',$texto) ;
return $texto ;
}
Veamos:
trim() = Elimina espacios en blanco (u otros caracteres) del principio y final de una cadena.
htmlspecialchars() = Convierte caracteres especiales a entidades HTML.
str_replace() = Sustituye todas las apariciones de una cadena en otra.
chr() = Devuelve un carácter especÃfico.
¿Cual es?
Por si no te das cuenta te dejo el código:
if($enviar) {
include("config.php") ;
function quitar($texto) {
$texto = trim($texto) ;
$texto = str_replace(chr(160),'',$texto) ;
return $texto ;
}