James,

> function CUP (
>     if ((!$alias) || (!$password)) {
>         header("Location: login.php");
>         exit;
>     }
> );
>

usually a function has the following structure:


function <name> ( <arguments> ) { <code> }


of course you can put any whitspace inside:

function <name> ( <arguments> )
{
        <code>
}

which makes it easy to read.

You can put anything you want inside a function, but you must know, that you
cannot directly access a variable, that is defined outside the function.


$name = "mOrP";

function print_name()
{
        echo $name;
}

print_name();

will not work.

Then you must 'get' the global variables (like $name):


$name = "mOrP";

function print_name()
{
        global $name;
        echo $name;
}

print_name();


But it's better to work with the function arguments:

$name = "mOrP"

function print_name($name_arg)
{
        echo $name_arg;
}

print_name($name);


notice, that there is no ";" behind the { ... } and the ( ... ) block in the
definition of the function.

Hope it helps,

mOrP.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to