我目前有这个代码:
array(0=>'foo', 1=>'bar', 3=>'baz', 4=>'boo', 5=>'wahoo');
What I want is this:
array(0=>'foo', 3=>'baz', 1=>'bar', 5=>'wahoo', 4=>'boo');
这是一个简化的例子,我的实际数组更大、更复杂,因此不能轻易地分成较小的部分并重新组合。
我一直在尝试使用uksort来解决这个问题,我认为这是前进的最佳方式,但似乎无法得到我想要的结果。
编辑:
我认为我的简化示例实际上混淆了问题。这是我的实际数组以及我想要最终达到的结果。
Array
(
[1820] => Safety
[1821] => Security
[1822] => Digital Life
[1893] => Privacy and Digital Footprints
[1823] => Connected Culture
[1824] => Respecting Creative Work
[1825] => Searching
[1826] => Research and Evaluation
[1836] => Self-Expression and Identity
)
Array
(
[1820] => Safety
[1821] => Security
[1822] => Digital Life
[1893] => Privacy and Digital Footprints
[1823] => Connected Culture
[1836] => Self-Expression and Identity
[1824] => Respecting Creative Work
[1825] => Searching
[1826] => Research and Evaluation
)
我几乎已经完成了一个数值排序,但有两个项目不在顺序中。