Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12097 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55034 invoked by uid 1010); 12 Aug 2004 03:03:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 54828 invoked from network); 12 Aug 2004 03:03:50 -0000 Received: from unknown (HELO mail.zend.com) (80.74.107.235) by pb1.pair.com with SMTP; 12 Aug 2004 03:03:50 -0000 Received: (qmail 31851 invoked from network); 12 Aug 2004 03:03:44 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 12 Aug 2004 03:03:44 -0000 Message-ID: <5.1.0.14.2.20040811200230.02a4cd88@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 11 Aug 2004 20:03:18 -0700 To: "Paul Hudson" , In-Reply-To: <20040811231743.C2932406AAB@mra02.ex.eclipse.net.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] PHP_EOL exposed to scripts? From: andi@zend.com (Andi Gutmans) References: <20040811231743.C2932406AAB@mra02.ex.eclipse.net.uk> I think it's a good idea. Personally I think that making this EOL would make it even easier to use. We tend to prefix constants but in this case, we should probably consider not doing so because it could be part of the language. Andi At 12:22 AM 8/12/2004 +0100, Paul Hudson wrote: >Hi there, > >This may already have been considered in the past, but I was wondering >whether the PHP_EOL constant available inside the PHP source code could be >made available to PHP programmers in their scripts? The current solution >is, of course, to check PHP_OS each time and set the constant by hand, but >it would be nicer to have it pre-defined. > >The cons are: 1) will break scripts that define their own PHP_EOL; and 2) >people might use it without realising it changes across platforms (duh?), >and rely on it to always be \n (or \r\n, etc); 3) Other cons? > >Anyway, the patch is predictably easy: add this line in main.c, after the >definition for PHP_SHLIB_SUFFIX: > >REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, >CONST_PERSISTENT | CONST_CS); > >I've attached a diff, such as it is. > >Thanks, > > >Paul > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php