不知道該怎麼去...php - 用另一個數組的元素替換數組元素?
但是,我有兩個數組,一個具有更新的信息,另一個具有過時的信息...第二個數組中有更多的元素,但我希望用更新的信息「更新」過時的。
這裏的陣列樣子:
//Outdated
Array (
[0] => Array
(
[anum] => 3236468462
[cid] => 4899097762
[mid] => 1104881401
[na_title] =>
[na_fname] => JOHN
[m_initial] =>
[na_lname] => DOE
[na_suffix] =>
[na_addr1] => 1234 SAMPLE AVENUE
[na_addr2] =>
[na_city] => NORWALK
[state] => OH
[zip] =>
[zip_plus_4] =>
[route] => R002
[dma_code] => 510334
)
)
//Updated
Array (
[1] => Array
(
[0] => YUD990
[1] => 98
[2] => 1234 Sample Avenue
[3] =>
[4] => Norwalk
[5] => OH
[6] => 44857-9215
[7] => 3236468462
)
)
爲了澄清,我想:
(1)匹配起來的值[7]從更新的陣列與[ANUM值],然後使用[2],[3],[4]的值更新過時數組中的[na_addr1],[na_addr2],[na_city],[state],[zip],[zip_plus_4] ],[5],[6](我知道我需要拆分更新的[6]以便將它映射到過時的地圖)
感覺就像我在做是非常令人困惑...對不起... ...
我想知道兩件事。 1.爲什麼兩個數組都只有一個元素是多維的? 2.爲什麼你的第二個數組以索引1開頭? – Babiker 2010-05-26 01:22:11