Re: session and global
| From: | Ben-Nes Michael | Date: | Thu, 30 Aug 2001 09:14:33 +0000 |
| Subject: | Re: session and global | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65187@lists.php.net to get a copy of this message | ||
if
global $var;
is called from within a function and $var exist outside the nested function
then the $var will be available to the function.
example
$var = "hello world";
function say_hello() {
global $var;
echo $var;
}
will echo "hello world"
while
$var = "hello world";
function say_hello() {
echo $var;
}
wont echo "hello world"
--------------------------
Canaan Surfing Ltd.
Internet Service Providers
Ben-Nes Michael - Manager
Tel: 972-4-6991122
http://sites.canaan.co.il
--------------------------
----- Original Message -----
From: "jacky" <jacky@activelifestyle.com>
To: <php-general@lists.php.net>
Sent: Thursday, August 30, 2001 11:40 AM
Subject: [PHP] session and global
Hi folks
I just wonder as I saw someone useing session with global and some don't.
What is the reason to use session together with global?
Like this:
session_start();
global $test
session_register('test');
I look up in manual using keyword "global", but could not find anything near
this.
Jack