title: PHP REGEX: Get domain from URL
body: <p><strong>What I want</strong></p>
  
  <hr>
  
  <p>I want to get from a <code>URL</code> the <code>domain</code> part so from <code>http://example.com/</code> -> <code>example.com</code></p>
  
  <p><strong>Examples:</strong></p>
  
  <hr>
  
  <pre><code>+----------------------------------------------+-----------------------+
  | input                                        | output                |
  +----------------------------------------------+-----------------------+
  | http://www.stackoverflow.com/questions/ask   | www.stackoverflow.com |
  | http://validator.w3.org/check                | validator.w3.org      |
  | http://www.google.com/?q=hello               | www.google.com        |
  | http://google.de/?q=hello                    | google.de             |
  +----------------------------------------------+-----------------------+
  </code></pre>
  
  <p>I found some related questions in <code>stackoverflow</code> but none of them was exactly what I was looking for. </p>
  
  <p>Thanks for any help!</p>