```
$multi = $_Post['multi_links'];
$links = explode("\n", $multi);
for ($i = 0; $i < count($links); $i++) 
{ 
$link=$links[$i]; 
$host = array_shift( explode( '.', str_replace('www.', '', parse_url($link,   PHP_URL_HOST))));
 ... 
}

```

what should i write in (...) to reorganise the links if they contain the same host and thanks ... here an exemple :
 if $multi="a.com/abc
 b.com/toto
 a.com/def
 b.com/cc
 b.com/ccc"
i get in every link the following :  

 link for host 'a.com' = 'a.com/abc | a.com/def'
 link for host 'b.com' = 'b.com/toto | b.com/cc | b.com/ccc'