$arr1 = array(
array('to' => '923336088811', 'country' => 'Pakistan' , 'operator' => 'Ufone (Pak Telecom)' , 'network_charges' => '0.5' , 'server' => '11' , 'methode' => 'JSON' , 'our_sms_id' => '235171135665' , 'our_sms_status_code' => '1' , 'action' => 'waiting' , 'message_status' => 'Pending' ),
array('to' => '923456812536', 'country' => 'Pakistan' , 'operator' => 'Ufone (Pak Telecom)' , 'network_charges' => '0.5' , 'server' => '11' , 'methode' => 'JSON' , 'our_sms_id' => '235171135665' , 'our_sms_status_code' => '1' , 'action' => 'waiting' , 'message_status' => 'Pending' ),
array('to' => '923008090100', 'country' => 'Pakistan' , 'operator' => 'Ufone (Pak Telecom)' , 'network_charges' => '0.5' , 'server' => '11' , 'methode' => 'JSON' , 'our_sms_id' => '235171135665' , 'our_sms_status_code' => '1' , 'action' => 'waiting' , 'message_status' => 'Pending' ),
);
$arr2 = array(
array('to' => '923336088811', 'country' => 'Pakistan' , 'operator' => 'ZONG' , 'network_charges' => '10' , 'server' => '18' , 'methode' => 'JSON' , 'our_sms_id' => '235171135665' , 'our_sms_status_code' => '1' , 'action' => 'waiting' , 'message_status' => 'Pending' ),
array('to' => '923008090100', 'country' => 'Pakistan' , 'operator' => 'New' , 'network_charges' => '10' , 'server' => '18' , 'methode' => 'JSON' , 'our_sms_id' => '235171135665' , 'our_sms_status_code' => '1' , 'action' => 'waiting' , 'message_status' => 'Pending' ),
);
$ported_numbers = array_uintersect($arr2, $arr1, 'compareDeepValue');
$check = array_diff_key($arr1, $ported_numbers);
$result = array_merge($ported_numbers, $check);
print_r($result);
function compareDeepValue($val1, $val2){
return strcmp($val1['to'], $val2['to']);
}
"to"に対して$ arr1の項目を置き換えたい。 2として、以下の項目がPHPダイナミックアレイの比較
Array
(
[0] => Array
(
[to] => 923336088811
[country] => Pakistan
[operator] => ZONG
[network_charges] => 10
[server] => 18
[methode] => JSON
[our_sms_id] => 1
[our_sms_status_code] => 4
[action] => waiting
[message_status] => Pending
)
[1] => Array
(
[to] => 923456812536
[country] => Pakistan
[operator] => Ufone (Pak Telecom)
[network_charges] => 0.5
[server] => 11
[methode] => JSON
[our_sms_id] => 2
[our_sms_status_code] => 1
[action] => waiting
[message_status] => Pending
)
[2] => Array
(
[to] => 923008090100
[country] => Pakistan
[operator] => new
[network_charges] => 10
[server] => 18
[methode] => JSON
[our_sms_id] => 5
[our_sms_status_code] => 1
[action] => waiting
[message_status] => Pending
)
)
はと$ ARR1でアイテムを交換する必要があるとして
が最終回答が必要=> '923336088811' => '923008090100' 'に' 'に' $のARR1 と一致していますキーを "to"と見なし、ループ構造を使用せずに出力を表示する必要があります。
ループを使用できないのはなぜですか? –
ループ構造はサーバーのより多くのリソースを消費します。 –
膨大な量のデータを処理していない、またはこれを頻繁に実行しない限り、ループを使用しないと、サーバー上の負荷よりもはるかに多くの負荷がかかることがあります。 –