File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings / http_build_query_variation3.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:10 2013 UTC (11 years ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

--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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>