You are here: Re: [PHP] Pre global configuration « PHP « IT news, forums, messages
Re: [PHP] Pre global configuration

Posted by James Kaufman on 09/27/05 18:38

On Tue, Sep 27, 2005 at 10:40:06AM -0400, 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.
>

You could do something like:

if (strtoupper(substr(php_uname('s'), 0, 3)) == 'WIN') {
define('CRLF', "\r\n");
} else {
define('CRLF', "\n");
}

Then use the constant CRLF in your strings. You can put the above snippet in a
file that is auto-prepended whenever php is invoked.

--
Jim Kaufman
Linux Evangelist
public key 0x6D802619
CCNA, CISSP# 65668

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация