Home >Backend Development >PHP Tutorial > 把同一id上的数组放一个数组

把同一id上的数组放一个数组

WBOY
WBOYOriginal
2016-06-13 13:13:381053browse

把同一id下的数组放一个数组
各位,

有如下数组:
  data[1] = 20
  data[2] = 30
  data[1] = 40
  data[1] = 50
  data[2] = 60
  data[3] = 70

分成如下组
  data[1] = array(20,40,50)
  data[2] = array(30,60)
  data[3] = array(70)

请教算法,要高效率的


------解决方案--------------------

探讨

是从数据库查的,但不能分组,效率太低了
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn