Generate URL with parameters from an array

All you need is http_build_query:

$final = $url . "?" . http_build_query($subids);

You can use with http_build_query() function. Example from php.net:

<?php
$data = array(
    'foo' => 'bar',
    'baz' => 'boom',
    'cow' => 'milk',
    'php' => 'hypertext processor',
);

echo http_build_query( $data ) . "\n";
echo http_build_query( $data, '', '&amp;' );
?>

And output this lines:

foo=bar&baz=boom&cow=milk&php=hypertext+processor
foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor

You can read from the source: http://www.php.net/manual/en/function.http-build-query.php

BTW, If you use with WordPress, you can this function: http://codex.wordpress.org/Function_Reference/add_query_arg

Have fun. :)

Tags:

Php

Arrays