here I have two json data, in the json data in model1 judul_kontrak
and model2 nama_proyek
there are two the same data aa, aa and cc data in model2 do not need to be displayed, only model1 data is displayed which are not the same.
the exit should only be bb from model1
$model1 = [
[
'judul_kontrak' => 'aa',
'kode' => '01'
],
[
'judul_kontrak' => 'bb',
'kode' => '02'
]
];
$model2 = [
[
'nama_proyek' => 'aa',
'kode' => '05'
],
[
'nama_proyek' => 'cc',
'kode' => '06'
]
];
$arr = [];
$proyek = [];
foreach ($model1 as $m1) {
$proyek['nama_proyek'] = $m1['judul_kontrak'];
foreach($model2 as $m2){
if(trim(strtolower($m1['judul_kontrak'])) == trim(strtolower($m2['nama_proyek']))){
$proyek = [];
}
}
$arr[] = $proyek;
}
return $arr;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…