Re: What's more effecient: var on every page or simple function?
| From: | Zef Hemel | Date: | Tue, 15 May 2001 08:08:40 +0000 |
| Subject: | Re: What's more effecient: var on every page or simple function? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52814@lists.php.net to get a copy of this message | ||
I'd say the first one, but if you'd use $myvar as a constant only, try this:
define("MYVAR",3);
Might be even more efficient ;-)
btw. You can call this value like this:
echo MYVAR;
Zef
"Noah Spitzer-Williams" <noahsw@cyberdude.com> schreef in berichtnieuws
9dpjiu$5nu$1@toye.p.sourceforge.net...
> Which of the two is more efficient:
>
> # start of file.php
> $myvar = 3;
> # end file.php
>
> #start of file.php
> function myvar() {
> return 3;
> }
> #end file.php
>
> the difference between the two is the first example would set the variable
> on every page regardless of whether it was used whereas with the function
> obviously it would be used only if it were called.
>
> what's better? (myvar is a constant #)
>
> - Noah
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>