php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9211 URL and PHP Info/Options functions NEEDED
Submitted: 2001-02-11 11:00 UTC Modified: 2005-06-29 12:16 UTC
From: chris at returnzero dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.3pl1 OS: *
Private report: No CVE-ID: None
 [2001-02-11 11:00 UTC] chris at returnzero dot com
parse_url() is a great function, but a counterpart to it would be even better.

Can we have a create_url() or create_query_string() function which would take an array of items and build it using the local value of arg_separator ?  A lot of users do NOT use arg_separator because many programs are written with & as the separator (and there is little documentation about it).  Programmers should want to accomodate ALL users though and support those which use ";" or "|" as the separator when writing programs designed to display URLs to get from page to page of their application.

$base = "/search.php";
$qs = array ("action" => "search", "word" => "php");
echo create_url($base, $qs);

If the arg_separator is set to ";" the above script would output:  /search.php?action=search;word=php

Also, ini_get("arg_separator") and get_cfg_var("arg_separator") don't work if it was set in .htaccess.  Could we perchance also have get_master_cfg_value() and get_local_cfg_value()?  Those would help solve the problem above, though programmers would have to write their own create_url() function to build urls with the arg_separator value. 

All three of those should be supported by PHP natively IMHO.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-29 12:16 UTC] nlopess@php.net
Added in PHP 5 as http_build_query().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC