NYCPHP Meetup

NYPHP.org

[nycphp-talk] Simple parse/replace

Robert Dumas rdumas at cmj.com
Thu Sep 18 18:03:34 EDT 2003


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030918/b2487215/attachment.html>


More information about the talk mailing list