what is happening now is this. I definemy constants in code1.php but I can
not reference them in my main code.
<code1.php>
//define my constant
define("mName", "My name");
<end of page>
<page1.php>
require_once(code1.php);
echo mName;
//prints "mName" - should print "My name"
What do I change - Many many thanks!
<laidbak69@hotmail.com> wrote in message
news:10ivhjsoh0ja44c@corp.supernews.com...[color=blue][color=green]
> > In this file I have variables I'd like to use in the calling page and
> > functions called by that page.[/color]
>
> You can use the a variable globally by using the superglobal array called
> $GLOBALS instead of the keyword global.
> Check here for more information:[/color]
http://us4.php.net/language.variables.scope[color=blue]
>
>
>
> There is another way, and this method is one I prefer personally.
> You can use the define keyword to define a constant. Constants defined[/color]
this[color=blue]
> way are automatially global, so you can access them from included scripts
> and functions as well.
>
> define('MYVARIABLE', 'stringvalue');
>
> print MYVARIABLE;
>
>
http://us4.php.net/define
>
> If you know you will not need to change the value you should use
> constants... if you have a reason to modify the value of the variable you
> should use the $GLOBALS array.
>
> ____________________________________
> Wil Moore III, MCP | Integrations Specialist
>
>[/color]