【发布时间】:2016-06-22 09:44:41
【问题描述】:
我有一个数组项如下。
Array
(
[0] => Array
(
[0] => 2
[field_id] => 2
[1] => Photometric Interpretation
[title] => Photometric Interpretation
[2] => text
[field_type] => text
)
[1] => Array
(
[0] => 3
[field_id] => 3
[1] => Make
[title] => Make
[2] => text
[field_type] => text
)
[2] => Array
(
[0] => 4
[field_id] => 4
[1] => Model
[title] => Model
[2] => text
[field_type] => text
)
[3] => Array
(
[0] => 5
[field_id] => 5
[1] => Strip Offsets
[title] => Strip Offsets
[2] => text
[field_type] => text
)
[4] => Array
(
[0] => 6
[field_id] => 6
[1] => Samples Per Pixel
[title] => Samples Per Pixel
[2] => text
[field_type] => text
)
[5] => Array
(
[0] => 7
[field_id] => 7
[1] => Rows Per Strip
[title] => Rows Per Strip
[2] => text
[field_type] => text
)
[6] => Array
(
[0] => 8
[field_id] => 8
[1] => Software
[title] => Software
[2] => text
[field_type] => text
)
[7] => Array
(
[0] => 9
[field_id] => 9
[1] => Exposure Time
[title] => Exposure Time
[2] => text
[field_type] => text
)
)
我需要根据以下数组的 VALUE 对数组的field_id INDEX 进行排序
Array
(
[0] => 7
[1] => 3
[2] => 4
[3] => 5
[4] => 2
[5] => 6
)
OR 到后面的字符串
7,3,4,5,2,6
我尝试使用uksort() 和uasort() 对数组进行排序。
【问题讨论】:
-
PHP - Sort multi-dimensional array by another array 的可能副本 - 拥有 3.3k 代表的人应该认为您会知道向我们展示您的尝试。
-
@Epodax 我已经尝试过该链接但无法正常工作,因此我提出了新问题。
-
Do I really need to link this? - 告诉我们你尝试了什么,为什么没有成功,你遇到了什么错误等等。
标签: php arrays multidimensional-array