flexibleDocString.test 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. Flexible heredoc/nowdoc (PHP 7.3)
  2. -----
  3. <?php
  4. $ary = [
  5. <<<FOO
  6. Test
  7. FOO,
  8. <<<'BAR'
  9. Test
  10. BAR,
  11. ];
  12. <<<'END'
  13. END;
  14. <<<END
  15. END;
  16. <<<END
  17. @@{ " " }@@
  18. END;
  19. <<<'END'
  20. a
  21. b
  22. c
  23. d
  24. e
  25. END;
  26. <<<END
  27. a
  28. b
  29. $test
  30. d
  31. e
  32. END;
  33. <<<'END'
  34. a
  35. b
  36. c
  37. d
  38. e
  39. END;
  40. <<<END
  41. a\r\n
  42. \ta\n
  43. b\r\n
  44. $test\n
  45. d\r\n
  46. e\n
  47. END;
  48. <<<BAR
  49. $one-
  50. BAR;
  51. <<<BAR
  52. $two -
  53. BAR;
  54. <<<BAR
  55. $three -
  56. BAR;
  57. <<<BAR
  58. $four-$four
  59. BAR;
  60. <<<BAR
  61. $five-$five-
  62. BAR;
  63. <<<BAR
  64. $six-$six-$six
  65. BAR;
  66. <<<BAR
  67. $seven
  68. -
  69. BAR;
  70. <<<BAR
  71. $eight
  72. -
  73. BAR;
  74. <<<BAR
  75. $nine
  76. BAR;
  77. <<<BAR
  78. -
  79. BAR;
  80. <<<BAR
  81. -
  82. BAR;
  83. -----
  84. array(
  85. 0: Stmt_Expression(
  86. expr: Expr_Assign(
  87. var: Expr_Variable(
  88. name: ary
  89. )
  90. expr: Expr_Array(
  91. items: array(
  92. 0: Expr_ArrayItem(
  93. key: null
  94. value: Scalar_String(
  95. value: Test
  96. )
  97. byRef: false
  98. )
  99. 1: Expr_ArrayItem(
  100. key: null
  101. value: Scalar_String(
  102. value: Test
  103. )
  104. byRef: false
  105. )
  106. )
  107. )
  108. )
  109. )
  110. 1: Stmt_Expression(
  111. expr: Scalar_String(
  112. value:
  113. )
  114. )
  115. 2: Stmt_Expression(
  116. expr: Scalar_String(
  117. value:
  118. )
  119. )
  120. 3: Stmt_Expression(
  121. expr: Scalar_String(
  122. value:
  123. )
  124. )
  125. 4: Stmt_Expression(
  126. expr: Scalar_String(
  127. value: a
  128. b
  129. c
  130. d
  131. e
  132. )
  133. )
  134. 5: Stmt_Expression(
  135. expr: Scalar_Encapsed(
  136. parts: array(
  137. 0: Scalar_EncapsedStringPart(
  138. value: a
  139. b
  140. )
  141. 1: Expr_Variable(
  142. name: test
  143. )
  144. 2: Scalar_EncapsedStringPart(
  145. value:
  146. d
  147. e
  148. )
  149. )
  150. )
  151. )
  152. 6: Stmt_Expression(
  153. expr: Scalar_String(
  154. value:
  155. a
  156. b
  157. c
  158. d
  159. e
  160. )
  161. )
  162. 7: Stmt_Expression(
  163. expr: Scalar_Encapsed(
  164. parts: array(
  165. 0: Scalar_EncapsedStringPart(
  166. value: a
  167. @@{ "\t" }@@a
  168. b
  169. )
  170. 1: Expr_Variable(
  171. name: test
  172. )
  173. 2: Scalar_EncapsedStringPart(
  174. value:
  175. d
  176. e
  177. )
  178. )
  179. )
  180. )
  181. 8: Stmt_Expression(
  182. expr: Scalar_Encapsed(
  183. parts: array(
  184. 0: Expr_Variable(
  185. name: one
  186. )
  187. 1: Scalar_EncapsedStringPart(
  188. value: -
  189. )
  190. )
  191. )
  192. )
  193. 9: Stmt_Expression(
  194. expr: Scalar_Encapsed(
  195. parts: array(
  196. 0: Expr_Variable(
  197. name: two
  198. )
  199. 1: Scalar_EncapsedStringPart(
  200. value: -
  201. )
  202. )
  203. )
  204. )
  205. 10: Stmt_Expression(
  206. expr: Scalar_Encapsed(
  207. parts: array(
  208. 0: Expr_Variable(
  209. name: three
  210. )
  211. 1: Scalar_EncapsedStringPart(
  212. value: -
  213. )
  214. )
  215. )
  216. )
  217. 11: Stmt_Expression(
  218. expr: Scalar_Encapsed(
  219. parts: array(
  220. 0: Expr_Variable(
  221. name: four
  222. )
  223. 1: Scalar_EncapsedStringPart(
  224. value: -
  225. )
  226. 2: Expr_Variable(
  227. name: four
  228. )
  229. )
  230. )
  231. )
  232. 12: Stmt_Expression(
  233. expr: Scalar_Encapsed(
  234. parts: array(
  235. 0: Expr_Variable(
  236. name: five
  237. )
  238. 1: Scalar_EncapsedStringPart(
  239. value: -
  240. )
  241. 2: Expr_Variable(
  242. name: five
  243. )
  244. 3: Scalar_EncapsedStringPart(
  245. value: -
  246. )
  247. )
  248. )
  249. )
  250. 13: Stmt_Expression(
  251. expr: Scalar_Encapsed(
  252. parts: array(
  253. 0: Expr_Variable(
  254. name: six
  255. )
  256. 1: Scalar_EncapsedStringPart(
  257. value: -
  258. )
  259. 2: Expr_Variable(
  260. name: six
  261. )
  262. 3: Scalar_EncapsedStringPart(
  263. value: -
  264. )
  265. 4: Expr_Variable(
  266. name: six
  267. )
  268. )
  269. )
  270. )
  271. 14: Stmt_Expression(
  272. expr: Scalar_Encapsed(
  273. parts: array(
  274. 0: Expr_Variable(
  275. name: seven
  276. )
  277. 1: Scalar_EncapsedStringPart(
  278. value:
  279. -
  280. )
  281. )
  282. )
  283. )
  284. 15: Stmt_Expression(
  285. expr: Scalar_Encapsed(
  286. parts: array(
  287. 0: Expr_Variable(
  288. name: eight
  289. )
  290. 1: Scalar_EncapsedStringPart(
  291. value:
  292. -
  293. )
  294. )
  295. )
  296. )
  297. 16: Stmt_Expression(
  298. expr: Scalar_Encapsed(
  299. parts: array(
  300. 0: Expr_Variable(
  301. name: nine
  302. )
  303. )
  304. )
  305. )
  306. 17: Stmt_Expression(
  307. expr: Scalar_String(
  308. value: -
  309. )
  310. )
  311. 18: Stmt_Expression(
  312. expr: Scalar_String(
  313. value: -
  314. )
  315. )
  316. )