$username = explode(',' $_GET['uid']);
$newusername = '';
foreach ($i = 0; $i <= count($username); $i++) {
if ($username[$i] != trim($deleteusername)) {
$newusername .= $username[$i] . ',';
}
}
Now I put the user ids that were not to be deleted into a string instead of an array as you are storing them as a string. If you need them in the an array for some other operation
$newusername = array();
foreach ($i = 0; $i <= count($username); $i++) {
if ($username[$i] != trim($deleteusername)) {
$newusername[] = $username[$i];
}
}