note 49625 deleted from function.parse-str by nikic
| From: | nikic@php.net | Date: | Thu, 23 Aug 2012 11:11:14 +0000 |
| Subject: | note 49625 deleted from function.parse-str by nikic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190183@lists.php.net to get a copy of this message | ||
Note Submitter: nospam at fiderallalla dot de
----
Maybe you need an opposite which works with arrays:
<?php
function query_str ($params) {
if ( !is_array($params) || count($params) == 0 ) return false;
$fga = func_get_args();
$akey = ( !isset($fga[1]) ) ? false : $fga[1];
static $out = Array();
foreach ( $params as $key=>$val ) {
if ( is_array($val) ) {
query_str($val,$key);
continue;
}
$thekey = ( !$akey ) ? $key : $akey.'['.$key.']';
$out[] = $thekey."=".$val;
}
return implode("&",$out);
}
?>