Help, please -- I've just started looking at my first line of PHP code.

:)


A little background, I am *not really* a programmer: I went to art 
school. 

I have taught myself to develop web stuff in another language: Lasso, 
but have no training.

In any case, I am looking through a php script that I've downloaded, 
and most of it makes at least some sense to me, but I have come upon:

        <?php

                define('BASE', './');
                include(BASE.'Functions/foo.php');
        ?>


Now, like any good lister, I checked the source first: php.net

<http://www.php.net/manual/en/language.constants.php> says:

"A constant is a identifier (name) for a simple value. As the name 
suggests, that value cannot change during the execution of the script 
(except the magic constants which aren't actually constants). A 
constant is case-sensitive by default. By convention constant 
identifiers are always uppercase. 

[...]

The scope of a constant is global--you can access it anywhere in your 
script without regard to scope."




So it is apparently *similar*, but not *exactly like* a variable, right?

Can anyone explain the difference to me?

A particular question I have is about what this phrase means:

"The scope of a constant is global--you can access it anywhere in your 
script without regard to scope."



When it says "anywhere in your script" does that mean it's available to 
"all of PHP"?

Or it is global to the rest of the file currently being processed, 
regardless of namespace, unlike a "normal" variable which might be 
unavailable in certain namespaces in the file?

Also, if anyone knows the subtleties of how any such differences effect 
the rest of the script, that'd be wonderful, too.


Thanks for any help!

        - me

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to