Generate URL-encoded query string


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. $data = array('foo'=>'bar',
  3. 'baz'=>'boom',
  4. 'cow'=>'milk',
  5. 'php'=>'hypertext processor');
  6.  
  7. echo http_build_query($data); // foo=bar&baz=boom&cow=milk&php=hypertext+processor
  8. echo http_build_query($data, '', '&amp;'); // foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor
  9.  
  10. ?>

URL: http://uk2.php.net/http_build_query

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.