Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8423 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88942 invoked by uid 1010); 7 Mar 2004 20:58:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 88903 invoked from network); 7 Mar 2004 20:58:32 -0000 Received: from unknown (HELO prp0.prp.physik.tu-darmstadt.de) (130.83.243.130) by pb1.pair.com with SMTP; 7 Mar 2004 20:58:32 -0000 Received: from prp0.prp.physik.tu-darmstadt.de (localhost [127.0.0.1]) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id i27KwWKf016635; Sun, 7 Mar 2004 21:58:32 +0100 Received: (from swalk@localhost) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/Submit) id i27KwV3T016634; Sun, 7 Mar 2004 21:58:31 +0100 Date: Sun, 7 Mar 2004 21:58:31 +0100 To: Louis-Philippe Huberdeau Cc: internals@lists.php.net Message-ID: <20040307205831.GA16606@prp0.prp.physik.tu-darmstadt.de> References: <404B64CC.5070108@sympatico.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <404B64CC.5070108@sympatico.ca> User-Agent: Mutt/1.3.27i Subject: Re: [PHP-DEV] Function proposal: nl2p From: swalk@prp.physik.tu-darmstadt.de (Stefan Walk) On Sun, Mar 07, 2004 at 01:07:08PM -0500, Louis-Philippe Huberdeau wrote: > I wrote this very simple function (modification from nl2br actually) to > convert newlines to well formatted HTML paragraphs instead of line > breaks, allowing better formatting of a dynamic output. It's not the > most perfect piece of code ever written, but it works and it can be > quite useful. > > The
tag does not have as much possibilities as the

tag when > it comes to CSS, which gave me the idea to write this function. > > -- function nl2p($str) { return '

'.preg_replace('/\r\n|\n|\r/', '

$0

', $str).'

'; } I think that function is not neccessary... nl2br is already redundant. They are one-liners in php itself... so no need to write functions for them. -- Regards, Stefan Walk