Here's an approach:
create an array $URLS_by_host=array()
Each key in this array will be a host (www.markolsen-artist.com, for example), and each value will be an array of all the URLs with that host. From here on we have a loop that goes through all the "$url"s.
So: we need the host. That's everything from after the '//' to the next '/'.
$scheme_end = strpos($url, '//')+2;
$next_slash = strpos($url, '/', $scheme_end);
$host = substr($url,$scheme_end,$next_slash-$scheme_end);
if we haven't already created a slot for this host in $URLS_by_host, we create one. if([man]array_key_exists/man) $URLS_by_host[$host]=array();
Now that there is a slot (either because there was one already or because we just created it) we look to see how many URLs it already contains. count($URLS_by_host[$host])
If there are two or three there already (your post is ambiguous on this point), [man]continue[/man]. Otherwise, add this $url: $URLS_by_host[$host][] = $url;
After that, all the URLs from www.markolsen-artist.com will be found in $URLS_by_host['www.markolsen-artist.com'] and so on.