1--TEST--
2testing the behavior of string offsets
3--FILE--
4<?php
5$string = "foobar";
6const FOO = "BAR"[0];
7var_dump(FOO);
8var_dump($string[0]);
9var_dump($string[1]);
10var_dump(isset($string[0]));
11var_dump(isset($string[0][0]));
12var_dump($string["foo"]);
13var_dump(isset($string["foo"]["bar"]));
14
15const FOO_DEPRECATED = "BAR"{0};
16var_dump(FOO_DEPRECATED);
17var_dump([$string{0}]); // 1 notice
18var_dump($string{1});
19var_dump(isset($string{0}));
20var_dump(isset($string{0}{0})); // 2 notices
21var_dump($string{"foo"});
22var_dump(isset($string{"foo"}{"bar"})); // 2 notices
23?>
24--EXPECTF--
25
26Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
27
28Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
29
30Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
31
32Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
33
34Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
35
36Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
37
38Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
39
40Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
41
42Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
43string(1) "B"
44string(1) "f"
45string(1) "o"
46bool(true)
47bool(true)
48
49Warning: Illegal string offset 'foo' in %s line %d
50string(1) "f"
51bool(false)
52string(1) "B"
53array(1) {
54  [0]=>
55  string(1) "f"
56}
57string(1) "o"
58bool(true)
59bool(true)
60
61Warning: Illegal string offset 'foo' in %s line %d
62string(1) "f"
63bool(false)
64