1--TEST--
2Test compact() function : basic functionality
3--FILE--
4<?php
5/*
6 * Test basic functionality
7 */
8
9echo "*** Testing compact() : basic functionality ***\n";
10
11$a=1;
12$b=0.2;
13$c=true;
14$d=array("key"=>"val");
15$e=NULL;
16$f="string";
17
18// simple array test
19var_dump (compact(array("a", "b", "c", "d", "e", "f")));
20// simple parameter test
21var_dump (compact("a", "b", "c", "d", "e", "f"));
22var_dump (compact(array("keyval"=>"a", "b"=>"b")));
23var_dump(compact(array("g")));
24
25echo "Done";
26?>
27--EXPECTF--
28*** Testing compact() : basic functionality ***
29array(6) {
30  ["a"]=>
31  int(1)
32  ["b"]=>
33  float(0.2)
34  ["c"]=>
35  bool(true)
36  ["d"]=>
37  array(1) {
38    ["key"]=>
39    string(3) "val"
40  }
41  ["e"]=>
42  NULL
43  ["f"]=>
44  string(6) "string"
45}
46array(6) {
47  ["a"]=>
48  int(1)
49  ["b"]=>
50  float(0.2)
51  ["c"]=>
52  bool(true)
53  ["d"]=>
54  array(1) {
55    ["key"]=>
56    string(3) "val"
57  }
58  ["e"]=>
59  NULL
60  ["f"]=>
61  string(6) "string"
62}
63array(2) {
64  ["a"]=>
65  int(1)
66  ["b"]=>
67  float(0.2)
68}
69
70Warning: compact(): Undefined variable $g in %s on line %d
71array(0) {
72}
73Done
74