【发布时间】:2021-08-05 05:17:22
【问题描述】:
问题
我有两个看起来像这样的多维数组,
第一个阵列
array(
[0] => Array
(
[course_id] => 10
[topic] => Booda-hood, advice and an important pit.
[lesson_id] => 10
)
[1] => Array
(
[course_id] => 10
[topic] => new topic
[lesson_id] => 11
)
)
第二个数组
Array
(
[0] => Array
(
[id] => 10
[description] => Lorem Ipsum is blablabla
[course_title] => Lorem Ipsum is
)
[1] => Array
(
[id] => 11
[description] => Lorem Ipsum is simply dummy text of
[course_title] => Lorem Ipsum
)
)
我想像这样合并两个数组 if($1st[0]['lesson_id'] == $2nd[0]['id'])
第三个数组
array(
[0] => Array
(
[course_id] => 10
[topic] => Booda-hood, advice and an important pit.
[lesson_id] => 10
[id] => 10
[description] => Lorem Ipsum is blablabla
[course_title] => Lorem Ipsum is
)
[1] => Array
(
[course_id] => 10
[topic] => new topic
[lesson_id] => 11
[id] => 11
[description] => Lorem Ipsum is simply dummy text of
[course_title] => Lorem Ipsum
)
)
我希望我能解释一切!
【问题讨论】:
-
到目前为止你尝试过什么?请出示代码。
-
创建一个你尝试过的minimal reproducible example
-
@unclexo 我想加入匹配键的数组,基本上,第一个数组是学生的进度,第二个是课程,所以我想检查学生的基础知识进度向学生展示的课程。如果学生在课程中有任何进步,则表明其他任何事情都不会发生。
标签: php arrays multidimensional-array array-combine