Re: PHP_EOL exposed to scripts?
| From: | Andi Gutmans | Date: | Thu, 12 Aug 2004 03:03:18 +0000 |
| Subject: | Re: PHP_EOL exposed to scripts? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-12097@lists.php.net to get a copy of this message | ||
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