1--TEST--
2Test http_build_query() function: usage variations - first arguments as object
3--CREDITS--
4Adam Gegotek <adam [dot] gegotek [at] gmail [dot] com>
5--FILE--
6<?php
7/* Prototype  : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
8 * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
9 * Source code: ext/standard/http.c
10*/
11
12class UrlBuilder
13{
14  public $name = 'homepage';
15  public $page = 1;
16  protected $sort = 'desc,name';
17  private $access = 'admin';
18}
19
20$obj = new stdClass;
21$obj->name = 'homepage';
22$obj->page = 1;
23$obj->sort = 'desc,name';
24
25echo http_build_query($obj) . PHP_EOL;
26echo http_build_query(new UrlBuilder());
27?>
28--EXPECTF--
29name=homepage&page=1&sort=desc%2Cname
30name=homepage&page=1
31