public function _encodeEntities($string)
    {
        $string = mb_convert_encoding($string, 'UTF-32', 'UTF-8');
        $t      = unpack("N*", $string);
        $t      = array_map(function ($n) {
            return "&#$n;";
        },
            $t);

        return implode("", $t);
    }
public function _encodeEntities($string)
    {
        $string = mb_convert_encoding($string, 'UTF-32', 'UTF-8');
        $t      = unpack("N*", $string);
        $t      = array_map(function ($n) {
            return "&#$n;";
        },
            $t);

        return implode("", $t);
    }
public function _encodeEntities ( $ string ) { $ string = mb_convert_encoding ( $ string , 'UTF-32' , 'UTF-8' ) ; $ t = unpack ( "N*" , $ string ) ; $ t = array_map ( function ( $ n ) { return "&#$n;" ; } , $ t ) ; return implode ( "" , $ t ) ; }
Returns a string converted to html entities.

@see http://goo.gl/LPhtJ

@param  string $string Value to be encoded

@return string
Returns a string converted to html entities .