note 61206 deleted from function.parse-url by nlopess
| From: | nlopess@php.net | Date: | Sat, 28 Jan 2006 10:55:44 +0000 |
| Subject: | note 61206 deleted from function.parse-url by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102607@lists.php.net to get a copy of this message | ||
Note Submitter: artmine77 at yahoo dot com
----
Here is an example that shows the benefits of working with full URLs, including the scheme.
If URL's path includes a colon (':' character) in it, scheme MUST be set, otherwise
parse_url reports the section after the colon as the value of the port.
Example :
<?php
$url="http://any.domain/?a=0:1";
$t=parse_url($url);
var_export($t);
?>
<br />
<?php
$url="any.domain/?a=0:1";
$t=parse_url($url);
var_export($t);
?>
will give:
array ( 'scheme' => 'http', 'host' => 'any.domain',
'path' => '/', 'query' => 'a=0:1', )
array ( 'host' => 'any.domain', 'port' => 1, 'path'
=> '/', 'query' => 'a=0:1', )
Cheers,
http://geocities.com/artmine77/