array: store multiple values per key

后端 未结 3 1862
心在旅途
心在旅途 2021-01-19 10:47

I once trying adding two values with the same key, but it didn\'t work. It overrode the old value. Isn\'t it possible to add more than one value with the same key, and when

3条回答
  •  旧巷少年郎
    2021-01-19 10:51

    the simplest option: wherever you use $array[$key]=... replace it with $array[$key][]=...

提交回复
热议问题