1--TEST--
2Test array_flip() function : usage variations - 'input' argument with different invalid values for keys
3--FILE--
4<?php
5/*
6* Trying different invalid values for 'input' array argument
7*/
8
9echo "*** Testing array_flip() : different invalid values in 'input' array argument ***\n";
10
11// class definition for object data
12class MyClass
13{
14   public function __toString()
15   {
16     return 'object';
17   }
18}
19$obj = new MyClass();
20
21// resource data
22$fp = fopen(__FILE__, 'r');
23
24$input = array(
25  // float values
26  'float_value1' => 1.2,
27  'float_value2' => 0.5,
28  'flaot_value3' => 3.4E3,
29  'flaot_value4' => 5.6E-6,
30
31  // bool values
32  'bool_value1' => true,
33  'bool_value2' => false,
34  'bool_value3' => TRUE,
35  'bool_value4' => FALSE,
36
37  // null values
38  'null_value1' => null,
39
40  // array value
41  'array_value' => array(1),
42
43  // object value
44  'obj_value' => $obj,
45
46  // resource value
47  'resource_value' => $fp,
48);
49
50var_dump( array_flip($input) );
51
52// closing resource
53fclose($fp);
54
55echo "Done"
56?>
57--EXPECTF--
58*** Testing array_flip() : different invalid values in 'input' array argument ***
59
60Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
61
62Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
63
64Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
65
66Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
67
68Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
69
70Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
71
72Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
73
74Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
75
76Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
77
78Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
79
80Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
81
82Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
83array(0) {
84}
85Done
86