User Tools

Site Tools


uphp:functions:htmlspecialchars

This is an old revision of the document!


htmlspecialchars

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Convert special characters for display in HTML

Description

string htmlspecialchars ( string $data )

Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function returns a string with these conversions made.

Parameter

$data: String to be formatted

Return Value

String with certain characters replaced. The translations performed are:

CHARACTERNAMETRANSLATED (HTML ENTITY)
&ampersand&
double quote"
'single quote'
<less than&lt;
>greater than&gt;

Example

<?
  $data="<a href='test'>Test</a>"
  $send=htmlspecialchars($data);
?>

The above example will set $send to the value &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;

uphp/functions/htmlspecialchars.1491908164.txt.gz · Last modified: 2021/09/13 05:56 (external edit)