"Andreas Kleist Svendsen" <usenetnospam@nau.dk> skrev i en meddelelse
news:a9v9n9$ami$1@sunsite.dk...
> -Martin- wrote:
>
> > MEN hvis register_globals er slået fra, altså "off" i php.ini så SKAL
> > man bruge $_GET[name]; eller $_POST[name]; DOG er jeg stadig lidt
> > usikker på om det er mest korrekt at sætte name i "" eller uden "".
>
> Man kan ikke i alle tilfælde bruge name, f.eks. ikke hvis name er en
> konstant, derimod virker "name" altid.
Ja... men name er ikke desto mindre _forkert_.
--Citat fra: <
http://dk.php.net/manual/en/language.types.array.php>
You might have seen the following syntax in old scripts:
$foo[bar] = 'enemy';
echo $foo[bar];
// etc
This is wrong, but it works. [...]
[...]
Then, how is it possible that $foo[bar] works? It works, because bar is due
to its syntax expected to be a constant expression. However, in this case no
constant with the name bar exists. PHP now assumes that you meant bar
literally, as the string "bar", but that you forgot to write the quotes.
So why is it bad then?
At some point in the future, the PHP team might want to add another constant
or keyword, and then you get in trouble. For example, you already cannot use
the words empty and default this way, since they are special keywords.
And, if these arguments don't help: this syntax is simply deprecated, and it
might stop working some day.
--citat slut
MVH Per Thomsen,
http://www.pert.dk/