Hi, im working on a script where i have the user ids stored in a field separated by periods. I am trying to create a function that can subtract two sets of users so it would basically complete the equation:
1.2.3.4 - 2.4 = 1.3
So far i have managed to get it so you can subract one number from an array, but i am stuck as to how i would subract a set of numbers?
Heres the code i have, theres so other stuff in there that isnt so important, its the second half of the function that matters:
function get_users($minus)
{
$this->query = mysql_query("SELECT * FROM cal_users");
$num = mysql_num_rows($this->query);
$users = array();
$out = array();
if($num > 0)
{
while($res = mysql_fetch_assoc($this->query))
{
array_push($users, $res);
}
}else{
$users = '';
}
//This is whats important
if($minus > 0)
{
$del = explode(".", $minus);
foreach($users as $user)
{
if($user['id'] == $minus)
{
continue;
}else{
array_push($out, $user);
}
}
}else{
$out = $users;
}
return $out;
}
Any help would be much appreciated!