note 36999 modified in function.str-replace by aidan
| From: | aidan@php.net | Date: | Fri, 25 Jun 2004 06:05:05 +0000 |
| Subject: | note 36999 modified in function.str-replace by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71636@lists.php.net to get a copy of this message | ||
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;
?>
--was--
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".
$motd = "/etc/motd";
$file = fopen("$motd", "r");
$content = fread($file, filesize($motd));
$content2 = str_replace("\n", "<br>", $content);
fclose($file);
print $content2;
http://php.net/manual/en/function.str-replace.php