<?php
// items from db
$array[] = [10, 20, 10];
$array[] = [10, 20, 201];
$array[] = [10, 20, 501];
$array[] = [10, 20, 601];
// new items
$arrayb[] = [10, 20, 10];
$arrayb[] = [10, 20, 20];
$arrayb[] = [10, 20, 50];
$arrayb[] = [10, 20, 60];
function compare(&$array,&$arrayb) {
foreach ($array as $k => $v) {
foreach ($arrayb as $k2 => $v2) {
if($v == $v2) {
unset($array[$k],$arrayb[$k2]); // removed matched items
}
}
}
}
compare($array,$arrayb);
// delete all
print_r($array);
echo '============';
// insert all
print_r($arrayb);
Gravity Web Apps headquartered in Delhi, India, is a sophisticated and Hi-Fi computerized advertising organization that is a skill in the field of innovative Website / CRM / ERP/, Designing with software Development, advance and classic Digital Marketing, Search Engine Optimization (SEO) and Brand building furthermore, Applications advancement.
Copyright © 2013, Gravity web apps All Rights Reserved.
Share This Blog