blob: c7c1876410d71e6eb844953f33e89f6547407b40 (
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
|
--TEST--
Using isset() with arrays
--FILE--
<?php
$array = [
0 => true,
"a" => true,
];
var_dump(isset($array[0]));
var_dump(isset($array["a"]));
var_dump(isset($array[false]));
var_dump(isset($array[0.6]));
var_dump(isset($array[true]));
var_dump(isset($array[null]));
var_dump(isset($array[STDIN]));
try {
isset($array[[]]);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
isset($array[new stdClass()]);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
bool(false)
Illegal offset type in isset or empty
Illegal offset type in isset or empty
|