配列

//文字列⇒配列化
$piecesUserId = explode(" ", preg_replace('/\s+/', ' ', trim($_GET['user_id'])));

//配列⇒文字列
$separatedArray = implode(",", $pieces);