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
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php