http_build_query – Generate URL-encoded query string

Posted by Paidboom - 1 year ago

http_build_query syntax Description, Parameters, Return Values and Examples

<?php
$content = array('fname'=>'xname',
              'lanme'=>'w3diy',
              'cname'=>'infinity',
              'php'=>'programming language');
echo http_build_query($content) . "\n";
echo http_build_query($content, '', '&');
?>

Example

<?php
$vars = array('page' => 45, 'search' => 'authorization');
$qs = http_build_query($vars);
$url = 'http://www.domaine-name.com/search.php?' . $qs;
echo $url;
?>