8 str=abc&num=-123&dec=123.123&bool=1&arr[]=1&arr[]=2&ma[l1][l2]=2&ma[l2][l3][l4]=3
13 printf("\nGlobal instance:\n");
14 $q = http\QueryString::getGlobalInstance();
17 printf("\nStandard getters:\n");
18 var_dump($q->getString("str"));
19 var_dump($q->getInt("num"));
20 var_dump($q->getFloat("dec"));
21 var_dump($q->getInt("dec"));
22 var_dump($q->getFloat("dec"));
23 var_dump($q->getBool("bool"));
24 var_dump($q->getInt("bool"));
25 var_dump($q->getBool("num"));
26 var_dump($q->getInt("num"));
27 var_dump($q->getArray("arr"));
28 var_dump($q->getArray("ma"));
29 var_dump($q->getObject("arr"));
30 var_dump($q->getObject("ma"));
34 printf("\nClone modifications do not alter global instance:\n");
35 $q->mod(array("arr" => array(3 => 3)));
38 printf("\nClone modifications do not alter standard instance:\n");
39 $q2 = new http\QueryString($s);
40 $q3 = $q2->mod(array("arr" => array(3 => 3)));
41 printf("%s\n%s\n", $q2, $q3);
44 printf("\nIterator:\n");
45 $it = new RecursiveIteratorIterator($q2, RecursiveIteratorIterator::SELF_FIRST);
46 foreach ($it as $k => $v) {
47 $i = $it->getDepth()*8;
48 @printf("%{$i}s: %s\n", $k, $v);
51 printf("\nReplace a multi dimensional key:\n");
52 printf("%s\n", $q2->mod(array("ma" => null))->set(array("ma" => array("l1" => false))));
55 $qu = new http\QueryString("ü=ö");
56 printf("utf8: %s\n", $qu);
57 printf("latin1: %s\n", method_exists($qu, "xlate") ? $qu->xlate("utf-8", "latin1") : "%FC=%F6");
59 printf("\nOffsets:\n");
61 $q2["ma"] = array("bye");
63 var_dump(isset($q2["ma"]));
65 var_dump(isset($q2["ma"]));
73 str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3
106 object(stdClass)#%d (2) {
112 object(stdClass)#%d (2) {
128 Clone modifications do not alter global instance:
129 str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3
131 Clone modifications do not alter standard instance:
132 str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3
133 str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&arr%5B3%5D=3&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3
150 Replace a multi dimensional key:
151 str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D=