summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/http_build_query_variation3.phpt
blob: 107120e084705d4856a2ef1219ed000e44990d97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--TEST--
Test http_build_query() function: usage variations - testing four parameter added in PHP 5.4.0
--CREDITS--
Adam Gegotek <adam [dot] gegotek [at] gmail [dot] com>
--SKIPIF--
<?php 
  if (version_compare(PHP_VERSION, '5.4.0', '<')) die("skip this test if PHP_VERSION is less than 5.4.0");
?>
--FILE--
<?php
/* Prototype  : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
 * Description: Generates a URL-encoded query string from the associative (or indexed) array provided. 
 * Source code: ext/standard/http.c
*/

$oDimensional = array(
  "name" => "main page",
  "sort" => "desc,admin",
  "equation" => "10 + 10 - 5"
);

echo http_build_query($oDimensional, '', ini_get('arg_separator.output'), PHP_QUERY_RFC1738) . PHP_EOL;
echo http_build_query($oDimensional, '', ini_get('arg_separator.output'), PHP_QUERY_RFC3986);
?>
--EXPECTF--
name=main+page&sort=desc%2Cadmin&equation=10+%2B+10+-+5
name=main%20page&sort=desc%2Cadmin&equation=10%20%2B%2010%20-%205