将多个数组从一个结果合并到PHP中的单个数组中

H2O*_*OCK 0 php mysql arrays

我真的很抱歉打扰你,我有一个问题,我一直试图解决一段时间了.我已经完成了一些研究并找到了像array_merge这样的东西,但它似乎没有帮助我.

无论如何,足够的华夫饼干.我有一个查询结果,看起来像这样:

Array
(
    [0] => STRINGA
)
Array
(
    [0] => STRINGA
    [1] => STRINGB
)
Array
(
    [0] => STRINGA
    [1] => STRINGB
    [2] => STRINGC
)
Array
(
    [0] => STRINGD
    [1] => STRINGC
    [2] => STRINGA
    [3] => STRINGB
    [4] => STRINGE
    [5] => STRINGF
)
Run Code Online (Sandbox Code Playgroud)

如何将上述内容组合到一个数组中,以使结果看起来更像:

Array
(
    [0] => STRINGA
    [1] => STRINGB
    [2] => STRINGC
    [3] => STRINGD
    [4] => STRINGE
    [5] => STRINGF
)
Run Code Online (Sandbox Code Playgroud)

可以忽略原始数组中的重复项,因为我只需要将字符串放入新数组中一次.

任何帮助都将受到大力赞赏.

谢谢.

编辑:这是从数据库中得出结果的代码块:

while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
    foreach($row as $splitrow) {
        if(NULL != $splitrow) {
            $therow = explode(';',$splitrow);
        }   
        //print_r retrieves result shown above
        print_r($therow);                                    
    }
}
Run Code Online (Sandbox Code Playgroud)

Hus*_*man 5

$bigarray = array(
  array (
    0 => 'STRINGA',
  ),
  array (
    0 => 'STRINGA',
    1 => 'STRINGB',
  ),
  array(
    0 => 'STRINGA',
    1 => 'STRINGB',
    2 => 'STRINGC',
  )
);


$result = array_values( 
    array_unique( 
        array_merge( $bigarray[0], $bigarray[1], $bigarray[2] ) 
    ) 
);  
// array_merge will put all arrays together, including duplicates
// array_unique removes duplicates
// array_values will sort out the indexes in ascending order (1, 2, 3 etc...)
Run Code Online (Sandbox Code Playgroud)