note 99364 modified in function.parse-str by danbrown

From: Date: Thu, 12 Aug 2010 18:08:38 +0000
Subject: note 99364 modified in function.parse-str by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171626@lists.php.net to get a copy of this message
If you need a function that does something similar to parse_str, but doesn't convert spaces and dots to underscores, try something like the following: <?php function parseQueryString($str) { $op = array(); $pairs = explode("&", $str); foreach ($pairs as $pair) { list($k, $v) = array_map("urldecode", explode("=", $pair)); $op[$k] = $v; } return $op; } ?> It may need adapting to handle various edge cases. --was-- If you need a function that does something similar to parse_str, but doesn't convert spaces and dots to underscores, try something like the following: function parseQueryString($str) { $op = array(); $pairs = explode("&", $str); foreach ($pairs as $pair) { list($k, $v) = array_map("urldecode", explode("=", $pair)); $op[$k] = $v; } return $op; } It may need adapting to handle various edge cases. http://php.net/manual/en/function.parse-str.php

« previous php.notes (#171626) next »