Version: v0.6.0 - Beta.  We welcome contributors & feedback.  THanks!

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 &gt; 2'

'abc'.encodeHtml(true);  //= '&#97;&#98;&#99;'

See Also