$phones[$i]->pub = $phones[$j]->pub; } } } } if (count($duplicates)) { foreach ($duplicates as $key => $bool) { unset($phones[$key]); } } if (count($phones) != $count) { $deleted += $count - count($phones); Phone::deletePhones($pid, 'user'); $id = 0; foreach ($phones as $phone) { $phone->setId($id); $phone->save(); ++$id; } XDB::execute('UPDATE IGNORE profile_merge_issues SET issues = REPLACE(issues, \'phone\', \'\') WHERE pid = {?}', $pid); } unset($duplicates); unset($phones); ++$done; ++$aux; if ($aux == 10) { $aux = 0; printf("\r%u / %u", $done, $total); }