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 . ','; } $num = rtrim($post_nums, ', '); $tnt = DataClass::get_friends_photos($num, $uid, $zone, $user_date, $date); $data = $tnt ? $tnt : []; if ($data) { $success = 1; $msg = "Profile Active"; } else { $success = 0; $msg = "No Records Found"; } } else { $success = 0; $msg = "No Records Found"; } } else { $success = 0; $msg = "Invalid User";