RE: [PHP] Two little questions
| From: | mOrP | Date: | Sun, 14 Jan 2001 17:32:49 +0000 |
| Subject: | RE: [PHP] Two little questions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34481@lists.php.net to get a copy of this message | ||
> function check_alias_password()
> global $alias, $password;
better:
global $alias;
global $password;
> {
> if ((!$alias) || (!$password)) {
> header("Location: login.php");
> exit;
> }
> }
>
> check_alias_password();
>
> work? Or would the last example need to be globals (variables) instead of
> global?
Yes, this will work - with the correction I've made, 'cause I'm not sure, if
you can assign two variables to 'global'...
But you can see, that it is not good to use the 'global' keyword, because
you must know the name of the variable, you use.
Look:
$name_1 = "Jan";
$name_2 = "Fritz";
function print_name($name_arg)
{
echo $name_arg;
}
print_name($name_1);
print_name($name_2);
You see, how flexible it is...
CU
mOrP