Re: [PHP4BETA] Is autoregister of HTTP_STATE_VARS possible?
| From: | Andrei Zmievski | Date: | Thu, 27 Apr 2000 15:26:51 +0000 |
| Subject: | Re: [PHP4BETA] Is autoregister of HTTP_STATE_VARS possible? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14073@lists.php.net to get a copy of this message | ||
On Wed, 26 Apr 2000, Jade Nicoletti wrote:
> Hi,
>
> Hmm, I'm not very happy with this right now. I think it could be done (much)
> better.
>
> Now, one has to do this:
>
> if(!isset($HTTP_SESSION_VARS['count'])) $HTTP_SESSION_VARS['count'] = 0;
> echo "count: ", $count = $HTTP_SESSION_VARS['count'] + 1;
>
> The array is for reading only. To store the new value, $count must be set.
>
> My proposal:
> echo "count: ", ++$HTTP_SESSION_VARS['count'];
>
> This behaviour whould make session handling even easier than it is today.
>
> To session_register():
> $HTTP_SESSION_VARS['foobar'] = 'my value i want to store';
> To session_unregister():
> unset($HTTP_SESSION_VARS['foobar']);
> To session_is_registered():
> isset($HTTP_SESSION_VARS['foobar']);
>
> Hm.. or is this possible? Are I'm missing something? :)
Yes, this is possible if you turn track_vars on and register_globals
off. Then anything in $HTTP_SESSION_VARS[] will be saved automatically.
-Andrei
* I don't mind going nowhere as long as it's an interesting path. *