summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_keys_variation_003.phpt
blob: adb2baea662dc543f897890bed95481138ed0093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
--TEST--
Test array_keys() function (variation - 3)
--FILE--
<?php

echo "*** Testing array_keys() on all the types other than arrays ***\n";
$types_arr = array(
  TRUE => TRUE,
  FALSE => FALSE,
  1 => 1,
  0 => 0,
  -1 => -1,
  "1" => "1",
  "0" => "0",
  "-1" => "-1",
  NULL,
  array(),
  "php" => "php",
  "" => ""
);
$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1",  NULL, array(), "php", "");
foreach ($values as $value){
	var_dump($value);
	var_dump(array_keys($types_arr, $value));
}

echo "Done\n";
?>
--EXPECT--
*** Testing array_keys() on all the types other than arrays ***
bool(true)
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(-1)
  [2]=>
  string(3) "php"
}
bool(false)
array(4) {
  [0]=>
  int(0)
  [1]=>
  int(2)
  [2]=>
  int(3)
  [3]=>
  string(0) ""
}
int(1)
array(1) {
  [0]=>
  int(1)
}
int(0)
array(4) {
  [0]=>
  int(0)
  [1]=>
  int(2)
  [2]=>
  string(3) "php"
  [3]=>
  string(0) ""
}
int(-1)
array(1) {
  [0]=>
  int(-1)
}
string(1) "1"
array(1) {
  [0]=>
  int(1)
}
string(1) "0"
array(1) {
  [0]=>
  int(0)
}
string(2) "-1"
array(1) {
  [0]=>
  int(-1)
}
NULL
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(3)
  [2]=>
  string(0) ""
}
array(0) {
}
array(2) {
  [0]=>
  int(2)
  [1]=>
  int(3)
}
string(3) "php"
array(1) {
  [0]=>
  string(3) "php"
}
string(0) ""
array(2) {
  [0]=>
  int(2)
  [1]=>
  string(0) ""
}
Done