public static function text($string)
    {
        /**
         * HTML Entity Encoding
         *
         * & => &amp;
         * < => &lt;
         * > => &gt;
         * " => &quot;
         * ' => &#x27; aka &#039;
         */
        $escaped = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');

        /**
         * QWASP recommendation:
         * / => &#x2F;
         *
         * Forward slash is included as it helps end an HTML entity
         */
        $escaped = str_replace("/", "&#x2F;", $escaped);

        return $escaped;
    }
public static function text($string)
    {
        /**
         * HTML Entity Encoding
         *
         * & => &amp;
         * < => &lt;
         * > => &gt;
         * " => &quot;
         * ' => &#x27; aka &#039;
         */
        $escaped = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');

        /**
         * QWASP recommendation:
         * / => &#x2F;
         *
         * Forward slash is included as it helps end an HTML entity
         */
        $escaped = str_replace("/", "&#x2F;", $escaped);

        return $escaped;
    }
public static function text ( $ string ) { /**
         * HTML Entity Encoding
         *
         * & => &amp;
         * < => &lt;
         * > => &gt;
         * " => &quot;
         * ' => &#x27; aka &#039;
         */ $ escaped = htmlspecialchars ( $ string , ENT_QUOTES | ENT_SUBSTITUTE , 'UTF-8' ) ; /**
         * QWASP recommendation:
         * / => &#x2F;
         *
         * Forward slash is included as it helps end an HTML entity
         */ $ escaped = str_replace ( "/" , "&#x2F;" , $ escaped ) ; return $ escaped ; }
Escapes untrusted data for inserting into html body

<body>...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...</body>
<div>...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...</div>

Per QWASP:
Most web frameworks have a method for HTML escaping for the characters detailed below.
However, this is absolutely not sufficient for other HTML contexts (attribute, javascript and css)

@param string $string Untrusted data

@return string Escaped string
Escapes untrusted data for inserting into html body