Return to Snippet

Revision: 13116
at April 9, 2009 10:35 by michaelfox


Initial Code
/**
 * jquery style extend, merges arrays (without errors if the passed values are not arrays)
 *
 * @return array $extended
 **/
function extend() {
	$args = func_get_args();
	$extended = array();
	if(is_array($args) && count($args)) {
		foreach($args as $array) {
			if(is_array($array)) {
				$extended = array_merge($extended, $array);
			}
		}
	}
	return $extended;
}

Initial URL

                                

Initial Description

                                

Initial Title
jQuery style extend in PHP

Initial Tags
php, textmate, array, jquery

Initial Language
PHP