note 100959 deleted from function.implode by thiago
| From: | thiago@php.net | Date: | Wed, 17 Nov 2010 13:07:41 +0000 |
| Subject: | note 100959 deleted from function.implode by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174118@lists.php.net to get a copy of this message | ||
Note Submitter: info at teleit dot pl
----
function implode_keys($glue,$arr,$before = null,$after = null) {
$i = 0; $str = null;
if(is_array($arr)):
$count = count($arr)
foreach($arr as $k=>$v) {
$i++;
$str. = ($i == 1 && $before !=null ? $before : null).$k.($i < $count ? $glue :
null).($i == $count && $after != null ? $after : null);
}
endif;
return $str;
}