public static function diff(array $val1, array $val2) {
		if (!$val1 || !$val2) {
			return $val2 ?: $val1;
		}
		$out = [];

		foreach ($val1 as $key => $val) {
			$exists = isset($val2[$key]);

			if (($exists && $val2[$key] !== $val) || !$exists) {
				$out[$key] = $val;
			}
			unset($val2[$key]);
		}

		foreach ($val2 as $key => $val) {
			if (!isset($out[$key])) {
				$out[$key] = $val;
			}
		}
		return $out;
	}
public static function diff(array $val1, array $val2) {
		if (!$val1 || !$val2) {
			return $val2 ?: $val1;
		}
		$out = [];

		foreach ($val1 as $key => $val) {
			$exists = isset($val2[$key]);

			if (($exists && $val2[$key] !== $val) || !$exists) {
				$out[$key] = $val;
			}
			unset($val2[$key]);
		}

		foreach ($val2 as $key => $val) {
			if (!isset($out[$key])) {
				$out[$key] = $val;
			}
		}
		return $out;
	}
public static function diff ( array $ val1 , array $ val2 ) { if ( ! $ val1 || ! $ val2 ) { return $ val2 ? : $ val1 ; } $ out = [ ] ; foreach ( $ val1 as $ key => $ val ) { $ exists = isset ( $ val2 [ $ key ] ) ; if ( ( $ exists && $ val2 [ $ key ] !== $ val ) || ! $ exists ) { $ out [ $ key ] = $ val ; } unset ( $ val2 [ $ key ] ) ; } foreach ( $ val2 as $ key => $ val ) { if ( ! isset ( $ out [ $ key ] ) ) { $ out [ $ key ] = $ val ; } } return $ out ; }
Computes the difference between two arrays.

@param array $val1 First value.
@param array $val2 Second value.
@return array Computed difference.
Computes the difference between two arrays .