I would like to shuffle emails by domains, making them as far as possible from each other. Example:
Array before:
email@hotmail.com, email2@hotmail.com, email3@hotmail.com, email@gmail.com, email2@gmail.com, email3@gmail.com, email@yahoo.com, email2@yahoo.com
It would become something like:
Array after:
email@hotmail.com, email@gmail.com, email@yahoo.com, email2@hotmail.com, email2@gmail.com, email2@yahoo.com, email3@hotmail.com, email3@gmail.com
How can I do it with an Array? If there is any example with PHP it would be great.