[nycphp-talk] Simple parse/replace
jon baer
jonbaer at jonbaer.net
Thu Sep 18 17:05:07 EDT 2003
RE: [nycphp-talk] Simple parse/replacehttp://us2.php.net/nl2br
<?php
$string = "this is\nonly a test\n";
echo $string;
echo nl2br($string);
?>
----- Original Message -----
From: Robert Dumas
To: 'NYPHP Talk'
Sent: Thursday, September 18, 2003 6:03 PM
Subject: RE: [nycphp-talk] Simple parse/replace
That's some great code. Thanks; it works beautifully.
One more thing: I have a text field for users to enter notes, but if they include a carriage return, it carries over to the log. How do I strip out any \n's a user has input (and preferably replace them with, say, a <br /> tag, or at least a space)?
-----Original Message-----
From: Adam Maccabee Trachtenberg [mailto:adam at trachtenberg.com]
Sent: Wednesday, September 10, 2003 7:35 PM
To: NYPHP Talk
Cc: LIPHP (E-mail)
Subject: Re: [nycphp-talk] Simple parse/replace
This should be enough to get you started:
$fp = fopen('foo.tab', 'r');
print "<table>\n";
while ($line = fgetcsv($fp, 1000, "\t")) {
print " <tr>\n <td>";
print join("</td>\n <td>", $line);
print "</td>\n </tr>\n";
}
print "</table>\n";
fclose($fp);
-adam
--
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
------------------------------------------------------------------------------
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030918/0c2e6961/attachment.html>
More information about the talk
mailing list