<?php
// urs_at_circle_dot_ch, 19-1-2001

/**
* txt in html umwandeln
**/
function txt2html ($str = "") {
    global $HTML_ENTITIES;

    $trans = get_html_translation_table(HTML_ENTITIES );
    return strtr($str, $trans);
}

/**
* html in txt umwandeln
**/
function html2txt ($str = "") {
    global $HTML_ENTITIES;

    $trans = array_flip(get_html_translation_table(HTML_ENTITIES ));
    $trans["&amp;"] = "&";
    return strtr($str, $trans);
}

// test ausgabe...
print(txt2html("dös chönns däch nüd mèchè.") . "<br/>\n" );
print(html2txt("d&ouml;s ch&ouml;nns d&auml;ch n&uuml;d m&egrave;ch&egrave;.") );

?>