LoginSignup
0
0

Golangでphpのarray_diff_assocをやる方法

Last updated at Posted at 2022-08-15
//php array_diff_assoc replacement
func ArrayDiffAssoc(s1, s2 map[string]interface{}) map[string]interface{} {
	r := make(map[string]interface{})
	for k, v := range s1 {
		if c, ok := s2[k]; !ok || c != v {
			r[k] = v
		}
	}
	return r
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0