-2
我有兩個數組是否值等於多multidimenional陣列
array_1是多方面的,但我需要的值的位置是
array_1['id']
array_2也是多方面的,地點是進一步在內部進行。
array_2['data']['id']
現在我試圖執行我的代碼只有當(===)這兩個ID是相同的。
更多信息是,這是2個API的組合,但是API的代碼工作正常,因爲如果我試圖從兩個API中獲取信息,它會顯示我。
代碼:
$orders = $apiSeo->orders->get();
$parcels = $apiSend->parcels->get();
foreach($orders as $id => $order){
if(($orders[$id]['paymentStatus'] == 'paid') || ($orders[$id]['paymentIsPost'] == true)){
echo '<pre>';
var_export($orders[$id]['id']);
var_export($orders[$id]['lastname']);
var_export($orders[$id]['paymentStatus']);
var_export($orders[$id]['paymentIsPost']);
echo '</pre>';
}
}
你有什麼我嘗試添加:
foreach($parcels as $id2 => $parcel){
if($orders[$id]['id'] === $parcels[$id2]['data']['order_id']){//}
}
,也沒有與array_key_exists或in_array更迭。
添加這些代碼段時,我的輸出與var_export或var_dump沒有任何關係。也沒有錯誤,而我有錯誤報告。所以我無能爲力,在錯誤或錯誤代碼的地方。
print_r的請求$包裹陣列
Array
(
[0] => Array
(
[id] => 1440143
[address] => xx
[address_divided] => Array
(
[street] => xx
[house_number] => 8
)
[city] => xx
[company_name] =>
[country] => Array
(
[iso_2] => NL
[iso_3] => NLD
[name] => Netherlands
)
[data] => Array
(
**[seoshop_order_id] => 15802836** HERE!
)
[date_created] => 03-03-2016 07:41:39
[email] => [email protected]
[name] => xx
[postal_code] => xx
[reference] => 0
[shipment] => Array
(
[id] => 10
[name] => DHL Complete with signature
)
[status] => Array
(
[id] => 1000
[message] => Ready to send
[history] =>
)
[telephone] => xx
[tracking_number] => JVGL0
[label] => Array
(
[normal_printer] => Array
(
[0] => https://panel.sendcloud.nl/api/v2/labels/normal_printer/1440143?start_from=0
[1] => https://panel.sendcloud.nl/api/v2/labels/normal_printer/1440143?start_from=1
[2] => https://panel.sendcloud.nl/api/v2/labels/normal_printer/1440143?start_from=2
[3] => https://panel.sendcloud.nl/api/v2/labels/normal_printer/1440143?start_from=3
)
[label_printer] => h1
)
[order_number] => ORD03
[carrier] => Array
(
[code] => dhl
)
[tracking_url] => xx
)
print_r的請求$訂單陣列往大了複製,並把所有的數組,也沒有必要,因爲不需要其他信息。
Array
(
[0] => Array
(
**[id] => 15817386** HERE!
你可以發佈有問題的兩個陣列的print_r嗎 –
@ChetanAmeta增加了先生!希望你對我有任何見解。 – izk
你想從parcel數組中比較'seoshop_order_id'嗎? –