note 54533 deleted from function.implode by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 13:16:44 +0000 |
| Subject: | note 54533 deleted from function.implode by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189725@lists.php.net to get a copy of this message | ||
Note Submitter: cristianDOTzuddas [AT] gmailDOTcom
----
...and another variation of "implode_assoc" function. Just added the boolean parameter
$urlencoded; if TRUE returns the array value in URL encod format. If the parameter is not given it
behaves like the original function.
<?
function implode_assoc($inner_glue, $outer_glue, $array, $skip_empty=false, $urlencoded=false) {
$output = array();
foreach($array as $key=>$item) {
if (!$skip_empty || isset($item)) {
if ($urlencoded)
$output[] = $key.$inner_glue.urlencode($item);
else
$output[] = $key.$inner_glue.$item;
}
}
return implode($outer_glue, $output);
}
?>