Re: array_push but with key, value pairs

From: Date: Tue, 17 Apr 2001 05:40:19 +0000
Subject: Re: array_push but with key, value pairs
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48896@lists.php.net to get a copy of this message
Peter Houchin wrote:
maybe tring this ... $input = array(); reset ($HTTP_POST_VARS); while ( list($key, $val) = each($HTTP_POST_VARS) ) { if ( $key != "Submit" ) { array_push($input, $val); } }
Hmm, as far as I can see this will just reset the internal pointer back to the start of the HTTP_POST_VAR array, I suppose this should be done in case I have called 'each' on the array before, but it does not answer my question being: I want to push the key and value into an array not just the value. I basically need array_push functionality but with the ablility to use your own index values. I hope this is more clear. Regards Joseph

« previous php.general (#48896) next »