public static function array_compare(&$arr1, &$arr2) {
		// Obviously bad data.
		if (! \is_array($arr1) || ! \is_array($arr2)) {
			return false;
		}

		$length = \count($arr1);

		// Length mismatch.
		if (\count($arr2) !== $length) {
			return false;
		}

		// Different keys, we don't need to check further.
		if (\count(\array_intersect_key($arr1, $arr2)) !== $length) {
			return false;
		}

		// We will ignore keys for non-associative arrays.
		if (
			(cast::array_type($arr1) !== 'associative') &&
			(cast::array_type($arr2) !== 'associative')
		) {
			return \count(\array_intersect($arr1, $arr2)) === $length;
		}

		// Check each item.
		foreach ($arr1 as $k=>$v) {
			if (! isset($arr2[$k])) {
				return false;
			}

			// Recursive?
			if (\is_array($arr1[$k]) && \is_array($arr2[$k])) {
				if (! static::array_compare($arr1[$k], $arr2[$k])) {
					return false;
				}
			}
			elseif ($arr1[$k] !== $arr2[$k]) {
				return false;
			}
		}

		return true;
	}