note 36999 deleted from function.str-replace by dave
| From: | dave@php.net | Date: | Thu, 12 Aug 2004 08:11:04 +0000 |
| Subject: | note 36999 deleted from function.str-replace by dave | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74529@lists.php.net to get a copy of this message | ||
Note Submitter: atr@mrcoffee.org
----
Simple and quick dirty way to get a MOTD (on a UNIX system) displayed properly on the web. Or, any
file with the UNIX newline char "\n".
<?php
$motd = "/etc/motd";
$file = fopen("$motd", "r");
$content = fread($file, filesize($motd));
$content2 = str_replace("\n", "<br>", $content);
fclose($file);
print $content2;
?>