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

javascript:

function array_diff_key( object ) {
	// Вычисляет расхождение массивов, сравнивая ключи
	// 
	// +   original by: Ates Goral (http://magnetiq.com)

	var tpm_ar = new Object(), argc = arguments.length, argv = arguments, key, argidx, other;

	for (key in object) {
		tpm_ar[key] = object[key];
	}
	for (argidx = 1; argidx < argc; ++argidx) {
		other = argv[argidx];

		if (other instanceof Object) {
			for (key in other) {
				delete tpm_ar[key];
			}
		}
	}

	return tpm_ar;
}

//Примеры:

   array_diff_key({red: 1, green: 2, blue: 3, white: 4});
// {"red":1, "green":2, "blue":3, "white":4}

   array_diff_key({red: 1, green: 2, blue: 3, white: 4}, {red: 5});
// {"green":2, "blue":3, "white":4}

   array_diff_key({red: 1, green: 2, blue: 3, white: 4}, {red: 5}, {green: 6, blue: 7});
// {"white":4}

   array_diff_key({red: 1, green: 2, blue: 3, white: 4}, {red: 5}, {red: 5});
// {"green":2, "blue":3, "white":4}