2010-08-15 62 views
2

array_push($数组的getData())给我:PHP array_push不正确的功能,使用什么?

Array 
(
    [customer] => One 
    [itemno] => Yellow Ribbon 

) 
Array 
(
    [customer] => One 
    [itemno] => Blue Band 
) 
Array 
(
    [0] => Array 
     (
      [customer] => Two 
      [itemno] => Red Tape 
     ) 
) 

但我想要的是:

Array 
(
    [customer] => One 
    [itemno] => Yellow Ribbon 

) 
Array 
(
    [customer] => One 
    [itemno] => Blue Band 
) 
Array 
(
    [customer] => Two 
    [itemno] => Red Tape 
) 

我应该怎么使用?

+1

是什么)的getData的代码(其可能使得它,返回数组[0] – 2010-08-15 12:42:50

回答

1

假设你正在使用数字键在$阵列,一个简单的array_merge($数组的getData())应该工作,因为的getData()显然是返回一个数字索引多维数组。

0

这将你想要做什么......

$array[] = getData();