You are here

25 November 2013

Encodes special characters in a plain-text string for display as HTML. Validates strings as UTF-8, if not UTF-8 it returns an empty string. It prevents CSS attacks on IE 6.

Source code viewer
  1. function plain_text($text) {
  2. return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  3. }
Programming Language: PHP