How to build a Query String in PHP?

How to Expose and Route to a Resource?
How to Expose and Route to a Resource?

Program – How to build a Query String in PHP? Sometime you need to construct a link that includes name/value pair in a query string here is a example.

Solution – Build a Query String in PHP

<?php
$var = array('name'=>'hindialerts.com', 'type'=>'website', 'content'=>'php tutorials');
$query_string = http_build_query($var);
$url = 'https://www.google.com/search?q='.$query_string;
echo $url;
?>

इसे भी पढ़े – LopScoop क्या है और इससे पैसे कैसे कमाएँ?

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *