Php 获取多个数组的特定组合

Php 获取多个数组的特定组合,php,sorting,multidimensional-array,Php,Sorting,Multidimensional Array,假设我有一个多维数组,它由3个数组组成(可能是1-100个),具有以下值: ['NAME'] => array( [0] => 'Bob', [1] => 'Mike' ), ['MIDDLE'] => array( [0] => 'goes to', [1] => 'hates' ), ['SUBJECT'] => array( [0] => 'the movies.', [1] => 'th

假设我有一个多维数组,它由3个数组组成(可能是1-100个),具有以下值:

['NAME'] => array(
    [0] => 'Bob',
    [1] => 'Mike'
),
['MIDDLE'] => array(
    [0] => 'goes to',
    [1] => 'hates'
),
['SUBJECT'] => array(
    [0] => 'the movies.',
    [1] => 'the swimmingpool.'
)
然后我想将它们转换为8个数组,其中包含以下值:

[0] => array(
    ['NAME'] => 'Bob',
    ['MIDDLE'] => 'goes to',
    ['SUBJECT'] => 'the movies.' 
),
[1] => array(
    ['NAME'] => 'Bob',
    ['MIDDLE'] => 'goes to',
    ['SUBJECT'] => 'the swimmingpool.' 
),
[2] => array(
    ['NAME'] => 'Bob',
    ['MIDDLE'] => 'hates',
    ['SUBJECT'] => 'the movies.' 
),
[2] => array(
    ['NAME'] => 'Bob',
    ['MIDDLE'] => 'hates',
    ['SUBJECT'] => 'the swimmingpool.' 
),
etc.
谁能给我一个正确方向的提示?
只是想不通。

嵌套for循环怎么样?嵌套for循环没有考虑到更多数组的可能性。我可以有8个值,比如NAME、MIDDLE和SUBJECT。8个值,比如NAME…,是什么意思?显示一个更复杂的示例置换,这是您在这里尝试实现的,在本例中,它将为您提供2^3=8的可能性。可能重复的