>>>>> "George" == George Pitcher <[EMAIL PROTECTED]> writes:

    George> Hi all, I'm working on a small solution and want to do
    George> some configuration during the initialising process.

    George> The solution is aimed at non tecchies in universities and
    George> the idea is that the system does some of the environment
    George> stuff for them.

    George> This is the first time I've done any of this stuff so I
    George> might be off-target.  Any suggested imptovements?

    George> George

    George> <?php
    George> if(in_array("Windows_NT",$HTTP_ENV_VARS)){
    George> $pdf_path="C:\\Pdf\\";
    George> if(substr($SERVER_SOFTWARE,0,6)=="Apache"){
    George> $webroot=$DOCUMENT_ROOT;
    George> }elseif(substr($SERVER_SOFTWARE,0,13)=="Microsoft-IIS"){
    George> $webroot=str_replace(str_replace("/","",$PATH_INFO),"",$PATH_TRANSLATED);
    George> }
    George> }elseif(in_array("linux_gnu",$HTTP_ENV_VARS)){
    George> $pdf_path="/var/pdf/";
    George> if(substr($SERVER_SOFTWARE,0,6)=="Apache")
    George> $webroot=$DOCUMENT_ROOT;
    George> }
    George> ?>

One thing that I like to do is to make sure that skip chains
are terminated with an else block.  for instance:

    if (COND A) {
        statements for condition a

    } else if (COND B) {
        statements for cond b

    } else if (COND C) {
        statements for cond c

    } else {
        none of conditions A, B, C held

this is a personal preference, though, influenced by my distaste
for analyzing weird faults.

Share your feedback at Affero:

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

Reply via email to