Reply to Re: [PHP] Pre global configuration

Your name:

Reply:


Posted by Silvio Porcellana on 09/27/05 18:18

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

[Back to original 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

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