note 56855 deleted from function.parse-url by nlopess
| From: | nlopess@php.net | Date: | Tue, 11 Oct 2005 20:08:47 +0000 |
| Subject: | note 56855 deleted from function.parse-url by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96854@lists.php.net to get a copy of this message | ||
Note Submitter: Nicolas Merlet - admin(at)merletn.org
----
About the last post, I advise to use 'empty' function in order to avoid 'notice'
errors...
Here is complete modified code :
<?php
function unparse_url ( $arr )
{
return ( $arr['scheme'] . '://' .
( empty ( $arr['user'] ) ? '' : $arr['user'] .
( empty ( $arr['pass'] ) ? '' : ':' . $arr['pass'] )
. '@' ) .
$arr['host'] . ( empty ( $arr['port'] ) ? '' : ':' .
$arr['port'] ) .
$arr['path'] . ( empty ( $arr['query'] ) ? '' : '?'
. $arr['query'] ) .
( empty ( $arr['fragment'] ) ? '' : '#' .
$arr['fragment'] )) ;
}
?>