if (!($contacts && $token)) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { $sql = "select * from users where verification_code=:token and is_deleted=0"; $sth = $conn->prepare($sql); $sth->bindValue('token', $token); try { $sth->execute(); } catch (Exception $e) { } $res = $sth->fetchAll(); $uid = $res[0]['id']; if (count($res)) { $current_date = DataClass::get_current_date($date, $zone); $tnt1 = DataClass::get_all_contacts(); // contacts fetched from database foreach ($tnt1 as $r) { foreach ($contacts as $row) { $a = substr_compare($r['phone_number'], $row, -10, 10); if ($a == 0) { $dict[] = $row; } } } //matched contacts b/w device and database if ($dict) { foreach ($dict as $key => $val) { $m = $val; $post_nums .= $m . ',';