我已经得到了默认每一个数组:PHP重新排序阵列
array(1=>1,2 =>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9)
现在的操作是有可能改变,例如号码为:
array(1=>1, 2=>1, 3=>3, 4=>1, 5=>1, 6=>6, 7=>7, 8=>8, 9=>9)
--> changed the value of key 1, 2, 4 and 5
这个我需要以下结果后
array(1=>1, 2=1, 3=>2, 4=>1, 5=>1, 6=>3, 7=>4, 8=>5, 9=>6 )
--> changed the value of key 3, 6, 7, 8, 9 in the right order that no number is missing like the operation has done above.
它的网格3x3。位置1是1,位置2是2,依此类推。现在数据库可以设置位置1,2,4,5是相同的并且与1相同。因此,数据库发送:1,1,3,1,1,6,7,8,9。现在来自地点的字段3是3,但应该是从2开始的字段。此外6的字段现在必须是字段3,依此类推。
注意:该操作可以更改数组中的每个值。例如 键值4,5,7,8
我该怎么做?
[你有什么尝试?](http://www.whathaveyoutried.com/)请参阅[问问建议](http://stackoverflow.com/questions/ask-advice)。 – 2013-03-08 13:49:24
[在这里你可以找到最简单的PHP问题,PHP.net页面的答案](http://php.net/manual/en/language.types.array.php)。另外,为什么你不谷歌“阵列PHP”? – 2013-03-08 13:52:25
你给我们提一个智商测试的问题吗? :D喜欢找到系列中的下一个元素? :) – 2013-03-08 13:53:35