note 49003 added to function.nl2br
| From: | spertica at tiscalinet dot it | Date: | Fri, 14 Jan 2005 09:23:19 +0000 |
| Subject: | note 49003 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83266@lists.php.net to get a copy of this message | ||
An easy way to get HTML formatted with <br> from a ASCII text file with CR & LF:
<?php
$string_text=file_get_contents("/path_to/file.txt"); // load text file in var
$new_text=nl2br($string_text); // convert CR & LF in <br> in newvar
echo $new_text; // print out HTML formatted text
unset($string_text, $new_text); // clear all vars to unload memory
?>
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49003
Delete -- http://master.php.net/manage/user-notes.php?action=delete+49003&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49003&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+49003&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+49003&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+49003&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+49003&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49003&report=yes
Search -- http://master.php.net/manage/user-notes.php