In article <9dsknt$fb1$[EMAIL PROTECTED]>,
[EMAIL PROTECTED] ("Noah Spitzer-Williams") wrote:
> So my question is should i just do:
>
> define("myvar", 3);
>
> OR:
>
> $myvar = 3;
>
> does defining it make that much of a difference (if i have several of these
> variables that could be defined instead).
I'm not sure whether there's a significant difference in memory usage, but
IMO the difference in scoping rules is a significant consideration.
Constants carry over into functions local scope, while variables must be
explicitely passed or declared as global in order to become available in a
function's local scope. Which one you consider to be the "convenience" and
which you consider the "nuisance" is in the eye of the beholder <g>, but
IMO either way it's a very handy/exploitable distinction which you can use
to speed up development/debugging time.
--
CC
--
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]