1--TEST--
2Flexible heredoc/nowdoc syntax
3--FILE--
4<?php
5
6$test = 'c';
7
8var_dump(<<<'END'
9 END);
10
11var_dump(<<<END
12
13  END);
14
15// Insufficient indentation is fine if the line is whitespace-only
16// Using eval() here to avoid issue with trailing whitespace trimming
17var_dump(eval("return <<<END
18\x20
19\x20\x20END;"));
20
21echo <<<'END'
22     a
23    b
24
25   c
26
27  d
28 e
29 END, PHP_EOL;
30
31echo <<<END
32	    a
33	   b
34	  $test
35	 d
36	e
37	END, PHP_EOL;
38
39echo <<<'END'
40
41    a
42
43   b
44
45  c
46
47 d
48
49e
50
51END, PHP_EOL;
52
53echo <<<END
54	a\r\n
55\ta\n
56   b\r\n
57  $test\n
58 d\r\n
59e\n
60END, PHP_EOL;
61
62echo <<<'END'
63    a
64   b
65  c
66 d
67e
68END, PHP_EOL;
69
70$var = 'Bar';
71var_dump(<<<TEST
72$var
73TEST);
74
75$var = 'Bar';
76var_dump(<<<TEST
77
78$var
79TEST);
80
81?>
82--EXPECT--
83string(0) ""
84string(0) ""
85string(0) ""
86    a
87   b
88
89  c
90
91 d
92e
93    a
94   b
95  c
96 d
97e
98
99    a
100
101   b
102
103  c
104
105 d
106
107e
108
109	a
110
111	a
112
113   b
114
115  c
116
117 d
118
119e
120
121    a
122   b
123  c
124 d
125e
126string(3) "Bar"
127string(4) "
128Bar"
129