html()
html(string $string) : string
Escaping for HTML blocks.
Parameters
string | $string |
Returns
string —Escaped HTML block.
js(string $string) : string
Escaping for inline javascript.
Example usage:
$esc_js = json_encode("Joshua's \"code\"");
$attribute = $this->js("alert($esc_js);");
echo '<input type="button" value="push" onclick="'.$attribute.'" />';
string | $string |
Escaped inline javascript.
htmlSpecialChars(string $string, integer $flags = ENT_QUOTES | ENT_HTML5, string $encoding = 'UTF-8', boolean $double_encoding = true) : string
Convert special characters to HTML entities
string | $string | The string being converted. |
integer | $flags | A bitmask of one or more flags. |
string | $encoding | An optional argument defining the encoding used when converting characters. |
boolean | $double_encoding | When double_encode is turned off PHP will not encode existing html entities, the default is to convert everything. |