Re: Pre global configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jake Gardner wrote:
> This is a stretch and I doubt you can do this very easily, but I was
> wondering if there is a way to define behaviors that happen throughout
> a script before execution for example if the OS is windows, all
> strings are terminated with \r\n, if Linux, then \n without adding
> addition ifs throughout the code.
> 
I don't know if it may help you, but why don't you set a constant in a
config file included by all your scripts to the CRLF value you want (if
you want it dependant on the OS you can use http://php.net/php_uname)
and then you append this constant to all your strings?

Example:

- config.inc.php:
define('CRLF', ( strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? "\r\n" :
"\n" ) );

- other_script.php
require_once 'config.inc.php';
....
$string = 'Hi! My name is Pippo!' . CRLF;


Or something like this... ;-)

Cheers
Silvio

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux