<?php
$followed = Array(
0=>array(
'label' =>"label0",
'id_poste'=>1,
'id_part'=>11,
'date'=>'9/12/21012'
),
1=>array(
'label' =>"label1",
'id_poste'=>2,
'id_part'=>12,
'date'=>'10/13/21012'
)
);
$unfollowed = Array(
0=>array(
'label' =>"New label",
'id_poste'=>1,
'id_part'=>11
)
);
これを実行して、2 つの配列をマージします。
$result = array_merge($followed,
array_udiff($unfollowed, $followed,
function($a,$b){
return strcmp($a['label'],$b['label']);
}
)
);
私は欲しいresult
Array
(
[0] => Array
(
[label] => label0
[id_poste] => 1
[id_part] => 11
[date] => 9/12/21012
)
[1] => Array
(
[label] => label1
[id_poste] => 2
[id_part] => 12
[date] => 10/13/21012
)
[2] => Array
(
[label] =>(A)New label /*concatenate with (A)*/
[id_poste] => 1
[id_part] => 11,
[date]=>'--/--/----' /* Append new element with that format*/
)
)
?>