PHP » GoLang |
login |
register |
about
|
array_combinearray_combine[code]
func ArrayCombine(s1, s2 []interface{}) map[interface{}]interface{} {
if len(s1) != len(s2) {
panic("the number of elements for each slice isn't equal")
}
m := make(map[interface{}]interface{}, len(s1))
for i, v := range s1 {
m[v] = s2[i]
}
return m
}
[/code]
|