【发布时间】:2012-07-09 09:06:01
【问题描述】:
我需要使用 PHP 重新排列跟随数组的顺序,我尝试使用数组 shuffle 和 array_random 但没有运气,谁能帮助我
Array (
[0] => Array (
[value] => 4
[label] => GasGas
)
[1] => Array (
[value] => 3
[label] => Airoh Helmets
)
[2] => Array (
[value] => 12
[label] => XCiting Trials Wear
)
[3] => Array (
[value] => 11
[label] => Hebo Trials
)
[4] => Array (
[value] => 10
[label] => Jitsie Products
)
[5] => Array (
[value] => 9
[label] => Diadora Boots
)
[6] => Array (
[value] => 8
[label] => S3 Performance
)
[7] => Array (
[value] => 7
[label] => Scorpa
)
[8] => Array (
[value] => 6
[label] => Inspired
)
[9] => Array (
[value] => 5
[label] => Oset
)
)
【问题讨论】:
-
你想怎么洗牌? shuffle 函数会随机化数组中元素的顺序。
-
看看stackoverflow.com/questions/4102777/…,它会给出你想要的答案。
-
我刚刚测试了这个,它在键盘中对我有用:codepad.org/6MmaY81i
标签: php multidimensional-array