$array = array(
array('x' => 1),
array('x' => 2),
array('x' => 3),
array('x' => 4),
array('y' => 5),
array('y' => 6)
);
foreach ($array as $arr)
{
foreach($arr as $key=>$value)
{
if($key == 'x')
{
$new_array['x'][] = $value;
} elseif ($key == 'y')
{
$new_array['y'][] = $value;
}
}
}
var_dump($new_array);
foreach ($mysql_query as $user)
{
......
$email = $user->email;
$first_name = $user->first_name;
.......
mail($to....$headers);
.......
}