htmlspecialchars
convert reserved characters to html entities
[...] = optional ... = your value
[var $... = ]call htmlspecialchars $val=…[;$flags=…][;$encoding=…][;$double_encoding=…]
Notes
$flags=ENT_QUOTES (single quotes are also converted)
$encoding =... charset encoding
for other options for flags and encoding settings see
htmlspecialchars on php.net
$double_encode=0 do not re encode existing html entities (default is to encode everything)
Example code
Example output
Reloadinput =
"foobar"output = <span style='color:red'>"foobar"</span>
actual output = <span style='color:red'>"foobar"</span>