Metti gli elementi che vuoi unire in un array e usi implode().