note 40712 deleted from ref.session by nlopess
| From: | nlopess@php.net | Date: | Fri, 12 Mar 2004 14:42:33 +0000 |
| Subject: | note 40712 deleted from ref.session by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66728@lists.php.net to get a copy of this message | ||
Note Submitter:
----
simonc att linux mail org:
quote:
--------------------
i.e.
$_SESSION["foo"] = 5
$foo = $_SESSION["foo"];
$foo = 2;
NOW $_SESSION["foo"] will equal 2.
--------------------
The "interesting feature" that you discovered is probably because you have
register_globals enabled.
Thus, when you first set $_SESSION['foo'] it is indeed 5.
Then you give $foo the value of $_SESSION['foo']. However, because register_globals is
turned on, you actually assign $_SESSION['foo'] = $_SESSION['foo'].
You can try this:
$_SESSION['foo'] = 5;
$foo = 2; //sets $_SESSION['foo'] = 2
You will find that $_SESSION['foo'] is now 2 also. Neat, huh? :)