如何将(推)数组合并到数组保持键和值

时间:2015-02-25 10:09:42

标签: php

当我尝试array_merge它在数组内部返回数组时,我无法弄清楚这个。我只是想从其他相同的数组中扩展它。

我有这样的数组,我怎样才能扩展它们,这样就会有更多的信息索引使数组更大。

["days"] => array(35) {
   [0] => object(stdClass) #4 (6) { 
    ["date"]= > string(10) "2014-06-29" 
    ["available"] => bool(false)
    ["type"] => string(11) "reservation" 
    ["subtype"] => NULL
    ["group_id"] => string(20) "reservation:17910584" 
    ["price"] => NULL
    }   
  [1] => object(stdClass) #5 (6) { 
    ["date"]= > string(10) "2014-06-30" 
    ["available"] => bool(false)
    ["type"] => string(11) "reservation" 
    ["subtype"] => NULL
    ["group_id"] => string(20) "reservation:17910584" 
    ["price"] => NULL
    }
}

另一个数组

["days"] => array(28) {
0-4....
[4] => object(stdClass) #8 (6) { 
["date"]= > string(10) "2014-07-03" 
["available"] => bool(false)
["type"] => string(11) "reservation" 
["subtype"] => NULL
["group_id"] => string(20) "reservation:19615924" 
["price"] => NULL
}

[5] => object(stdClass) #9 (6) { 
["date"]= > string(10) "2014-07-04" 
["available"] => bool(false)
["type"] => string(11) "reservation" ["subtype"] => NULL
["group_id"] => string(20)
"reservation:19615924" 
["price"] => NULL

}[6] => object(stdClass) #10 (6) { 
["date"]= > string(10) "2014-07-05" 
["available"] => bool(false)
["type"] => string(11) "reservation" 
["subtype"] => NULL
["group_id"] => string(20) "reservation:28128591" 
["price"] => NULL
}
6-28...
}

0 个答案:

没有答案