note 40039 deleted from language.variables.external by danbrown

From: Date: Wed, 09 Mar 2011 14:41:07 +0000
Subject: note 40039 deleted from language.variables.external by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177708@lists.php.net to get a copy of this message
Note Submitter: jan.gacioch at motorola dot com ---- Just a correction regarding 'cscotti@ifrance' contribution: code '$first = $item_value;' should be place just BEFORE the 'else if' condition and NOT AFTER. So correct code would be: function multi_post_item() { $array_output = array(); $raw_input_items = split("&", $_SERVER["QUERY_STRING"]); foreach ($raw_input_items as $input_item) { // split this item into name/value pair $item = split("=", $input_item); // form item name $item_name = urldecode($item[0]); // form item value $item_value = urldecode($item[1]); if ( !isset($array_output[$item_name]) ) { $array_output[$item_name] = $item_value; $first = $item_value; } elseif ( !is_array($array_output[$item_name]) ) { $array_output[$item_name] = array(); $array_output[$item_name][]= $first; $array_output[$item_name][]= $item_value; } else { $array_output[$item_name][]= $item_value; } } return $array_output; }

« previous php.notes (#177708) next »