At 12:40 PM +0100 8/16/08, Stut wrote:
On 16 Aug 2008, at 12:36, tedd wrote:
The problem here is can I use a variable within a $_SESSION[] declaration?
Like so:
$_SESSION[$var]
I haven't really been following this thread but using a variable
like that is perfectly valid. $_SESSION is no different to any other
array during the processing of your script, the only difference is
that it's stored between requests.
-Stut
Stut:
I was hoping you would join in. But I solved the problem and found a
surprising result.
The result is you cannot use a number as an index in a $_SESSION, like so:
$a = "20";
$_SESSION[$a] = "good morning'; <-- won't work
But you can use:
$a = "a20';
$_SESSION[$a] = "good night'; <-- will work
Furthermore, if you do make that mistake, all other $_SESSION
variables declared AFTER the incident will cease to work. Isn't that
interesting?
Here's an example:
http://www.webbytedd.com/b2/session-test1/index.php
The code is at the bottom of the page.
Please tell me that you didn't know this, for if you do, it will make
my day. On the other hand, if you tell me where I it wrong, it will
still make my day. :-)
Always a pleasure listening to your thoughts and advice.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php