Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8051777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:22:40+00:00 2026-06-05T07:22:40+00:00

I want to create an url out of an array with the help of

  • 0

I want to create an url out of an array with the help of http_build_query (PHP). This is the Array:

$a = array("skip" => 1, "limit" => 1, "startkey" => '["naturalProduct","Apple"]')

After calling

$s = http_build_query($a);

I get the following string $s:

skip=1&limit=1&startkey=%5B%22naturalProduct%22%2C%22Apple%22%5D

My problem is, that I would need an url like this:

skip=1&limit=1&startkey=["naturalProduct","Apple"]

which means, that I don’t want to convert the following symbols: “,[]

I have written a conversion function which I call after the http_build_query:

str_replace(array("%5B", "%22", "%5D", "%2C"), array('[', '"', ']', ','), $uri);

My question now: Is there a better way to reach the expected results?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:22:41+00:00Added an answer on June 5, 2026 at 7:22 am

    My question now: Is there a better way to reach the expected results?

    Yes, there is something better. http_build_query­Docs by default uses an URL encoding as outlined in RFC 1738. You just want to de-urlencode the string. For that there is a function that does this in your case: urldecode­Docs:

    $s = http_build_query($a);
    echo urldecode($s);
    

    I hope you are aware that your URL then is no longer a valid URL after you’ve done that. You already decoded it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create this output with PHP: foreach ($bk as $blink) { $out[url][] = $blink->url;
I want to create URL re-write rules for following URL in htaccess. http://example.com/vedios/category/fun/ ->
I want to create updated URL when Next 1000 button is clicked on the
I am using CakePHP and want to create a URL to a controller/view without
In my JSF web-app, I want to create a URL for the user to
I want to use URL such as /Image/sample.png I create route, but it does
I want create an application with animate button? how can i do? after click
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I want to create a PHP function that goes through a website's homepage, finds
I have an array in PHP that looks like this: [0]=> array(2) { [name]=>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.