note 68842 deleted from function.implode by betz
| From: | betz@php.net | Date: | Sun, 13 Aug 2006 13:19:57 +0000 |
| Subject: | note 68842 deleted from function.implode by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-115863@lists.php.net to get a copy of this message | ||
Note Submitter: worldwideweb dot C-Kling dot de
----
A Script for imploding a multideimensional Array. You give an array of separators in the first
argument, and a (multidimensional) array in the second. The script will return the imploded array.
function multimplode($spacer,$array)
{
if (!is_array($array))
{
return($array);
}
if (empty($spacer))
{
return(multimplode(array(""),$array));
}
else
{
$trenn=array_shift($spacer);
while (list($key,$val) = each($array))
{
if (is_array($val))
{
$array[$key]=multimplode($spacer,$val);
}
}
$array=implode($trenn,$array);
return($array);
}
}