String.encodeHtml
encodeHtml($encodeAll = false)
Description
Encode special HTML characters (<>&'"
) into HTML entities.
NoteThis is usually unnecessary if you are using HTML template functions, which automatically escape output.
If $encodeAll
is true
, encode all characters in the string.
'1 + 3 > 2'.encodeHtml(); //= '1 + 3 > 2' 'abc'.encodeHtml(true); //= 'abc'