title: How to get base of a random URL with PHP?
body: <p>I need a function to get the base of an URL.
  (URLs will be submit by users, and could be everything!)
  As example:</p>
  
  <pre><code>    https://en.wikipedia.org/wiki/Murphy%27s_law =&gt; wikipedia.org
      https://en.m.wikipedia.org/wiki/Murphy%27s_law =&gt; wikipedia.org
      http://userpage.chemie.fu-berlin.de/diverse/murphy/murphy_e.html 
  =&gt; fu-berlin.de
      http://www.murphyslawpetone.co.nz/ =&gt; murphyslawpetone.co.nz
  </code></pre>