original_string: public static function num_htmlentities($str)
      {
          $charset = 'ISO-8859-1';
  
          if (!self::$htmlentities) {
              self::$htmlentities = array();
              $table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, $charset);
              foreach ($table as $char => $entity) {
                  self::$htmlentities[$entity] = '&#' . ord($char) . ';';
              }
          }
  
          return str_replace(
              array_keys(
                  self::$htmlentities
              ), self::$htmlentities, htmlentities($str, ENT_COMPAT | ENT_HTML401, $charset)
          );
      }
code: public static function num_htmlentities($str)
      {
          $charset = 'ISO-8859-1';
  
          if (!self::$htmlentities) {
              self::$htmlentities = array();
              $table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, $charset);
              foreach ($table as $char => $entity) {
                  self::$htmlentities[$entity] = '&#' . ord($char) . ';';
              }
          }
  
          return str_replace(
              array_keys(
                  self::$htmlentities
              ), self::$htmlentities, htmlentities($str, ENT_COMPAT | ENT_HTML401, $charset)
          );
      }
code_tokens: public static function num_htmlentities ( $ str ) { $ charset = 'ISO-8859-1' ; if ( ! self :: $ htmlentities ) { self :: $ htmlentities = array ( ) ; $ table = get_html_translation_table ( HTML_ENTITIES , ENT_QUOTES , $ charset ) ; foreach ( $ table as $ char => $ entity ) { self :: $ htmlentities [ $ entity ] = '&#' . ord ( $ char ) . ';' ; } } return str_replace ( array_keys ( self :: $ htmlentities ) , self :: $ htmlentities , htmlentities ( $ str , ENT_COMPAT | ENT_HTML401 , $ charset ) ) ; }
docstring: Converts special characters to numeric htmlentities.
  
  <b>Note</b>:<br>
  If supplied string is encoded with UTF-8, o umlaut ("ö") will become two
  HTML entities instead of one.
  
  @param string $str String to be converted.
  
  @return string String converted to numeric HTML entities.
docstring_tokens: Converts special characters to numeric htmlentities .