Re: are Predefined variables really predefined?
| From: | Richard Lynch | Date: | Tue, 14 Nov 2000 22:18:54 +0000 |
| Subject: | Re: are Predefined variables really predefined? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25288@lists.php.net to get a copy of this message | ||
> include "$DOCUMENT_ROOT/file.php"
> include "$DOCUMENT_ROOT/file.php"
> include "$DOCUMENT_ROOT/file.php"
> include "$DOCUMENT_ROOT/file.php"
> include "$DOCUMENT_ROOT/file.php"
>
> example 2:
>
> $document_root = $DOCUMENT_ROOT;
> include "$document_root /file.php"
> include "$document_root /file.php"
> include "$document_root /file.php"
> include "$document_root /file.php"
> include "$document_root /file.php"
>
> Now what I am asking you is to think in microseconds and tell me what is
> faster?
>
> To be precise my question is: are Predefined Variables REALLY Predefined
or
> they do not exist unless you call them?
They really are predefined, almost for sure.
> If they don't then calling them twice should make your script slower then
> assign it's value once to a *normal* variable and use it later all over
the
> script, right?
You won't even be able to measure the difference, but adding a second
variable to the lookup table instead of using the predefined one will slow
down the variable lookup.
Worrying about performance instead of maintenance for the bulk of your code
is just wrong.