1--TEST--
2Test array_fill_keys() function : variation of parameter
3--FILE--
4<?php
5/* Prototype  : proto array array_fill_keys(array keys, mixed val)
6 * Description: Create an array using the elements of the first parameter as keys each initialized to val
7 * Source code: ext/standard/array.c
8 * Alias to functions:
9 */
10
11/* Testing with unexpected argument types */
12
13echo "*** Testing array_fill_keys() : parameter variations ***\n";
14
15$fp = fopen(__FILE__, "r");
16$bool = false;
17$float = 2.4;
18$array = array("one");
19$nullVal = null;
20$unset_var = 10;
21unset ($unset_var);
22
23
24class classA {
25  public function __toString() { return "Class A object"; }
26}
27$obj = new classA();
28
29echo "\n-- Testing array_fill_keys() function with float --\n";
30var_dump( array_fill_keys($array, $float) );
31
32echo "\n-- Testing array_fill_keys() function with null --\n";
33var_dump( array_fill_keys($array, $nullVal) );
34
35echo "\n-- Testing array_fill_keys() function with object --\n";
36var_dump( array_fill_keys($array, $obj) );
37
38echo "\n-- Testing array_fill_keys() function with boolean --\n";
39var_dump( array_fill_keys($array, $bool) );
40
41echo "\n-- Testing array_fill_keys() function with resource --\n";
42var_dump( array_fill_keys($array, $fp) );
43
44echo "\n-- Testing array_fill_keys() function with unset var --\n";
45var_dump( array_fill_keys($array, $unset_var) );
46
47fclose($fp);
48echo "Done";
49?>
50--EXPECTF--
51*** Testing array_fill_keys() : parameter variations ***
52
53-- Testing array_fill_keys() function with float --
54array(1) {
55  ["one"]=>
56  float(2.4)
57}
58
59-- Testing array_fill_keys() function with null --
60array(1) {
61  ["one"]=>
62  NULL
63}
64
65-- Testing array_fill_keys() function with object --
66array(1) {
67  ["one"]=>
68  object(classA)#%d (0) {
69  }
70}
71
72-- Testing array_fill_keys() function with boolean --
73array(1) {
74  ["one"]=>
75  bool(false)
76}
77
78-- Testing array_fill_keys() function with resource --
79array(1) {
80  ["one"]=>
81  resource(%d) of type (stream)
82}
83
84-- Testing array_fill_keys() function with unset var --
85
86Notice: Undefined variable: unset_var in %sarray_fill_keys_variation4.php on line %d
87array(1) {
88  ["one"]=>
89  NULL
90}
91Done
92