Return to Snippet

Revision: 17314
at August 31, 2009 22:02 by iloveitaly


Initial Code
function implode_on_key($array, $key, $sep, $prefix = '') {
	$string = '';
	
	if(empty($array)) return '';
	
	foreach($array as $element) {
		$string .= $prefix.$element[$key].$sep;
	}
	
	return substr($string, 0, -strlen($sep));
}

Initial URL

                                

Initial Description

                                

Initial Title
Implode On Array Item Key

Initial Tags
php, array

Initial Language
PHP