note 16759 deleted from function.unset by jimw

From: Date: Fri, 07 Dec 2001 01:14:03 +0000
Subject: note 16759 deleted from function.unset by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21759@lists.php.net to get a copy of this message
Had a spot of bother with the idea that HTTP_GET_VARS['whatever'] operates as one reference when you've got the global form variables turned on, (see me care about looking up what it's called). Of course I had quite forgotten about referenced variables because the way I code things what would be the point? So, I coded this... foreach ($HTTP_GET_VARS as $key => $value) { $HTTP_GET_VARS[$key] = null; } and of course it did not work, because the script, which authenticates users, (I know about sessions, I'm just not using them), still read the variable being referenced, which wasn't what I thought was logical. There is more than one way of thinking about things however, and after a bit of head banging, I wrote this... foreach ($HTTP_GET_VARS as $key => $value) { $HTTP_GET_VARS[$key] = null; $$key = null; } which works and is rather elegant in my opinion, as all programming should be.

« previous php.notes (#21759) next »