Security update for Core, with self-updated composer
[yaffs-website] / vendor / nikic / php-parser / test / code / prettyPrinter / expr / literals.test
1 Literals
2 -----
3 <?php
4
5 // magic constants
6 __LINE__;
7 __FILE__;
8 __DIR__;
9 __FUNCTION__;
10 __CLASS__;
11 __TRAIT__;
12 __METHOD__;
13 __NAMESPACE__;
14
15 // not actually literals, but close
16 null;
17 true;
18 false;
19 NULL;
20 TRUE;
21 FALSE;
22
23 // integers (normalized to decimal)
24 0;
25 11;
26 011;
27 0x11;
28 0b11;
29
30 // floats (normalized to ... something)
31 0.;
32 .0;
33 0.0;
34 0e1000;
35 1.0;
36 1e100;
37 1e1000;
38 1E-100;
39 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
40 378282246310005.0;
41 10000000000000002.0;
42
43 // strings (single quoted)
44 'a';
45 'a
46 b';
47 "a";
48 "a\nb";
49 'a\'b';
50
51 // strings (double quoted)
52 "a'b";
53 "a\b";
54 "$a";
55 "a$b";
56 "$a$b";
57 "$a $b";
58 "a${b}c";
59 "a{$b}c";
60 "a$a[b]c";
61 "\{$A}";
62 "\{ $A }";
63 "\\{$A}";
64 "\\{ $A }";
65 "{$$A}[B]";
66 "$$A[B]";
67
68 // make sure indentation doesn't mess anything up
69 function foo()
70 {
71     "a\nb";
72     'a
73 b';
74     'a
75     b';
76 }
77
78 // shell exec (similar to double quoted string)
79 `foo`;
80 `foo$a`;
81 `foo{$a}bar`;
82 `\`\'\"`;
83 -----
84 // magic constants
85 __LINE__;
86 __FILE__;
87 __DIR__;
88 __FUNCTION__;
89 __CLASS__;
90 __TRAIT__;
91 __METHOD__;
92 __NAMESPACE__;
93 // not actually literals, but close
94 null;
95 true;
96 false;
97 NULL;
98 TRUE;
99 FALSE;
100 // integers (normalized to decimal)
101 0;
102 11;
103 011;
104 0x11;
105 0b11;
106 // floats (normalized to ... something)
107 0.0;
108 0.0;
109 0.0;
110 0.0;
111 1.0;
112 1.0E+100;
113 \INF;
114 1.0E-100;
115 1.0E+84;
116 378282246310005.0;
117 10000000000000002.0;
118 // strings (single quoted)
119 'a';
120 'a
121 b';
122 "a";
123 "a\nb";
124 'a\'b';
125 // strings (double quoted)
126 "a'b";
127 "a\\b";
128 "{$a}";
129 "a{$b}";
130 "{$a}{$b}";
131 "{$a} {$b}";
132 "a{$b}c";
133 "a{$b}c";
134 "a{$a['b']}c";
135 "\\{{$A}}";
136 "\\{ {$A} }";
137 "\\{$A}";
138 "\\{ {$A} }";
139 "{${$A}}[B]";
140 "\${$A['B']}";
141 // make sure indentation doesn't mess anything up
142 function foo()
143 {
144     "a\nb";
145     'a
146 b';
147     'a
148     b';
149 }
150 // shell exec (similar to double quoted string)
151 `foo`;
152 `foo{$a}`;
153 `foo{$a}bar`;
154 `\`\\'\\"`;