note 49625 added to function.parse-str
| From: | nospam at fiderallalla dot de | Date: | Thu, 03 Feb 2005 10:29:58 +0000 |
| Subject: | note 49625 added to function.parse-str | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84425@lists.php.net to get a copy of this message | ||
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);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.parse-str.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49625
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49625&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49625&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49625&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49625&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49625&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49625&report=yes
Search -- http://master.php.net/manage/user-notes.php