获取多个阵列的特定组合

时间:2016-12-16 19:59:34

标签: 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] => '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.

任何人都能给我一个正确方向的暗示吗? 只是想不出来。

0 个答案:

没有答案