我有两个数组
activeTopics
$activeTopics = Array
(
"100" => Array
(
"activationDate" => "2018-11-28 16:19:22"
),
"200" => Array
(
"activationDate" => "2018-11-28 16:21:06"
),
"300" => Array
(
"activationDate" => "2018-11-28 16:23:18"
)
);
pedagogyTopics
$pedagogyTopics = Array
(
"0" => Array
(
"pedagogyID" => 200,
"higherLevelStatus" => "available"
),
"1" => Array
(
"pedagogyID" => 100,
"higherLevelStatus" => "No"
)
);
我的要求是,pedagogyTopics
pedagogyID等于activeTopics
索引意味着我要使用activationDate
并推送到pedagogyTopics,
之后,我想根据activation date
ASC顺序对数组进行排序,我编写了代码,它也可以正常工作。我的问题是我做对了吗?还是我们可以简化代码?我在数据库中有大量记录。我在这里使用两个foreach循环,这就是为什么我担心的原因