title: PHP Parse URL - Domain returned as path when protocol prefix not present
body: <p>I am trying to parse URL's in PHP where the input could be any of the following:</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>$info = parse_url('http://www.domainname.com/');
  print_r($info);
  
  $info = parse_url('www.domain.com');
  print_r($info);
  
  $info = parse_url('/test/');
  print_r($info);
  
  $info = parse_url('test.php');
  print_r($info);
  </code></pre>
  
  <p><strong>Returns:</strong></p>
  
  <pre><code>Array
  (
      [scheme] =&gt; http
      [host] =&gt; www.domainname.com
      [path] =&gt; /
  )
  Array
  (
      [path] =&gt; www.domain.com
  )
  Array
  (
      [path] =&gt; /test/
  )
  Array
  (
      [path] =&gt; test.php
  )
  </code></pre>
  
  <p>The problem you can see is the second example where the domain is returned as a path.</p>