0

This is my array:

$url_parameter = Array ( 'country' => 'USA', 'city' => 'WDC', 'from' => 'Japan' );

I want to covert it so that output is:

country=USA&city=WDC&from=Japan

Is there any easy code to do this task?

2
  • could you please give me the link of answer? Commented Mar 31, 2015 at 19:16
  • http_build_query($url_parameter), help on php.net : php.net/http_build_query Commented Mar 31, 2015 at 19:17

1 Answer 1

3
$url_parameter = Array ( 'country' => 'USA', 'city' => 'WDC', 'from' => 'Japan' );

echo http_build_query($url_parameter) . "\n";
echo http_build_query($url_parameter, '', '&');
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.