note 40995 added to function.chr
| From: | mcusack at fastlanecompanies dot com | Date: | Thu, 25 Mar 2004 21:46:22 +0000 |
| Subject: | note 40995 added to function.chr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67179@lists.php.net to get a copy of this message | ||
when working with output to a windows system i.e. a textfile the end of line "\n" will not
return a valid newline that windows will understand (this is due to a lack of standards accross OS
types) this is because windows reads new lines as carriage return and an additional char the
linefeed the traditional "\n" so in short use the following to produce a new line under a
windows text environment "\r\n"
// not tested but this should work in most cases (i think....)
function win_nl2br($stringtext) {
return str_replace("\r\n", "<br>", $stringtext);
}
function win_br2nl($stringtext) {
return str_replace("<br>", "\r\n", $stringtext);
}
Hope this is as informative to you as it was to me ......
----
Manual Page -- http://www.php.net/manual/en/function.chr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40995
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40995&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40995&report=yes
Search -- http://master.php.net/manage/user-notes.php