AllUsers
我有一个数组
Array AllUsers
(
[0] => Array
(
[0] => Array
(
[0] => Tim
[1] => tim@gmail.com
)
[1] => Array
(
[0] => John
[1] => john@gmail.com
)
)
[1] => Array
(
[0] => Array
(
[0] => Mike
[1] => mike@gmail.com
)
[1] => Array
(
[0] => Aron
[1] => aron@gmail.com
)
)
)
我有另一个FilteredUsers
数组
Array FilteredUsers
(
[0] => Array
(
[0] => John
[1] => john@yahoo.com
)
[1] => Array
(
[0] => Mike
[1] => mike@yahoo.com
)
[2] => Array
(
[0] => Mike
[1] => mike@outlook.com
)
)
现在我想要的是添加FilteredUsers[]
inAllUsers[]
这样的每个元素 -
FilteredUsers[0]
应该添加到BatchAllUsers[1]
中,因为BatchAllUsers[0]
中已经有元素名称为 John 的数组- 同样
FilteredUsers[1]
应该添加到批处理AllUsers[0]
- 任何批次(如
AllUsers[0]
,AllUsers[1]
)都不能超过 3 个元素。如果所有批次都已满,则应创建一个新批次,但其中的每个元素FilteredUsers[]
都应容纳在某个批次中。
所以更新后的AllUsers
数组应该是这样的 -
Array AllUsers
(
[0] => Array
(
[0] => Array
(
[0] => Tim
[1] => tim@gmail.com
)
[1] => Array
(
[0] => John
[1] => john@gmail.com
)
[2] => Array
(
[0] => Mike
[1] => mike@yahoo.com
)
)
[1] => Array
(
[0] => Array
(
[0] => Mike
[1] => mike@gmail.com
)
[1] => Array
(
[0] => Aron
[1] => aron@gmail.com
)
[2] => Array
(
[0] => John
[1] => john@yahoo.com
)
)
[2] => Array
(
[0] => Array
(
[0] => Mike
[1] => mike@outlook.com
)
)
)