| Escape HTML Characters |
|
|
Page 2 of 2 htmlspecialchars() function Is very much like htmlentities() function. Unlike this function, it does not convert all applicable characters to HTML entities, but only some of them: - '&' (ampersand) becomes '&' - '"' (double quote) becomes '"' when ENT_NOQUOTES is not set. - ''' (single quote) becomes ''' only when ENT_QUOTES is set. - '<' (less than) becomes '<' - '>' (greater than) becomes '>' Otherwise, functions parameters are the same: string htmlspecialchars ( string $string [, int $quote_style [, string $charset]] ); To see the difference between these two functions I will show you an example: The simple text: <b>Confirmar contraseña</b> for htmlentities() function will output: <b>Confirmar contraseña</b> and for htmlspecialchars() function will output: <b>Confirmar contraseña</b> See the difference? For the first function, the special Spanish character ñ is translated also, while for the second is left unchanged.
|
||||
Escape HTML Characters 
