【发布时间】:2021-11-17 08:51:56
【问题描述】:
如何比较两个数组值并从内部数组中删除重复值并使用 PHP 存储在另一个数组中。由array[name] 比较的数组,并希望删除所有内部数组中的相关索引。
数组 1
Array
(
[0] => detail12.docx
[1] => resume.docx
)
数组 2
Array
(
[name] => Array
(
[0] => detail12.docx
[1] => document.pdf
[2] => resume.docx
)
[type] => Array
(
[0] => application/vnd.openxmlformats-officedocument.wordprocessingml.document
[1] => application/pdf
[2] => application/vnd.openxmlformats-officedocument.wordprocessingml.document
)
[tmp_name] => Array
(
[0] => /tmp/php2LK7xC
[1] => /tmp/phpTEWqXG
[2] => /tmp/phpAKki0M
)
[error] => Array
(
[0] => 0
[1] => 0
[2] => 0
)
[size] => Array
(
[0] => 30887
[1] => 86118
[2] => 30887
)
)
预期输出:-
Array
(
[name] => Array
(
[0] => detail12.docx
[1] => resume.docx
)
[type] => Array
(
[0] => application/vnd.openxmlformats-officedocument.wordprocessingml.document
[1] => application/vnd.openxmlformats-officedocument.wordprocessingml.document
)
[tmp_name] => Array
(
[0] => /tmp/php2LK7xC
[1] => /tmp/phpAKki0M
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 30887
[1] => 30887
)
)
我需要上述预期输出中所示的输出。请提供代码以获得解决方案!
【问题讨论】: