PHP-функция: endСписок php-функций

javascript:

function end ( array ) {
	// Set the internal pointer of an array to its last element
	// 
	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   bugfixed by: Legaev Andrey

	var last_elm, key;

	if (array.constructor === Array){
		last_elm = array[(array.length-1)];
	} else {
		for (key in array){
			last_elm = array[key];
		}
	}

	return last_elm;
}

//Примеры:

alert ( end({firstname: 'Kevin', middle: 'van', surname: 'Zonneveld'}) );