On Friday 04 April 2003 03:47, Tom Rawson wrote:
> Hmmm, this doesn't seem clear in the docs ...
>
> Consider this:
>
>       function foo() {
>               $_SESSION['varname'] = "test";
>               .....
>       }
>
> At this point:
>
> - Can I reference $varname inside the function?  If so, must it be
> declared global first?  Or can I only reference it via
> $_SESSION['varname']?
>
> - Can I reference it outside the function (as $varname) after the
> function returns?
>
> In other words if one creates a variable by adding it to the session
> array, does it then become a variable in either the global or (though I
> can't quite imagine this) current local scope?

You should *always* refer to it as $_SESSION['varname'] regardless of whatever 
scope you're in.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Freedom is slavery.
Ignorance is strength.
War is peace.
                -- George Orwell
*/


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

Reply via email to