TechniqueUse a combination of htmlentities() and nl2br() to convert the document: <?php $doc = implode("", file($conversion_file)); $doc = nl2br(htmlentities($doc)); print $doc; ?> CommentsThe htmlentities() function replaces all special HTML characters such as , , and with the equivalent escape character sequences. The nl2br() function takes all newline characters and inserts a <br> tag (HTML line break). Converting ASCII to HTML is really that simple! |