我有数组数组,我只需要按照我的要求重新排列数组即可。这是我的数组的输出。
Array
(
[36736] => Array
(
[meta] => Array
(
[Closing Date] =>
[Technical Consultant] =>
[Client Name] =>
[Stage] => Waiting for Technical Assignment
[Contract Name] =>
[Signing Rate] =>
[Contract Number] =>
[Client Number] =>
[Closer Name] =>
[Completed On] => 2019-05-23
[Assigned Date] => 05/22/2019 12:28 pm
)
)
预期输出
Array
(
[36736] => Array
(
[meta] => Array
(
[Client Name] =>
[Client Number] =>
[Contract Name] => this is secod contract or abc
[Contract Number] =>
[Stage] => Waiting for Technical Assignment
[Closing Date] =>
[Technical Consultant] =>
[Signing Rate] =>
[Closer Name] =>
[Completed On] => 2019-05-23
[Assigned Date] => 05/22/2019 12:28 pm
)
)
答案 0 :(得分:0)
您可以通过创建所需的自定义订单键数组来实现
$keys = ["Client Name", "Client Number", "Contract Name", "Contract Number", "Stage", "Closing Date",
"Technical Consultant", "Signing Rate", "Closer Name", "Completed On", "Assigned Date"];
foreach ($arr as $key => &$value) { // & defines changes will be reflected at its address in memory
$value['meta'] = array_replace(array_flip($keys), $value["meta"]);
}