docString.test 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Nowdoc and heredoc strings
  2. -----
  3. <?php
  4. // empty strings
  5. <<<'EOS'
  6. EOS;
  7. <<<EOS
  8. EOS;
  9. // constant encapsed strings
  10. <<<'EOS'
  11. Test '" $a \n
  12. EOS;
  13. <<<EOS
  14. Test '" \$a \n
  15. EOS;
  16. // encapsed strings
  17. <<<EOS
  18. Test $a
  19. EOS;
  20. <<<EOS
  21. Test $a and $b->c test
  22. EOS;
  23. b<<<EOS
  24. Binary
  25. EOS;
  26. -----
  27. array(
  28. 0: Stmt_Expression(
  29. expr: Scalar_String(
  30. value:
  31. comments: array(
  32. 0: // empty strings
  33. )
  34. )
  35. comments: array(
  36. 0: // empty strings
  37. )
  38. )
  39. 1: Stmt_Expression(
  40. expr: Scalar_String(
  41. value:
  42. )
  43. )
  44. 2: Stmt_Expression(
  45. expr: Scalar_String(
  46. value: Test '" $a \n
  47. comments: array(
  48. 0: // constant encapsed strings
  49. )
  50. )
  51. comments: array(
  52. 0: // constant encapsed strings
  53. )
  54. )
  55. 3: Stmt_Expression(
  56. expr: Scalar_String(
  57. value: Test '" $a
  58. )
  59. )
  60. 4: Stmt_Expression(
  61. expr: Scalar_Encapsed(
  62. parts: array(
  63. 0: Scalar_EncapsedStringPart(
  64. value: Test
  65. )
  66. 1: Expr_Variable(
  67. name: a
  68. )
  69. )
  70. comments: array(
  71. 0: // encapsed strings
  72. )
  73. )
  74. comments: array(
  75. 0: // encapsed strings
  76. )
  77. )
  78. 5: Stmt_Expression(
  79. expr: Scalar_Encapsed(
  80. parts: array(
  81. 0: Scalar_EncapsedStringPart(
  82. value: Test
  83. )
  84. 1: Expr_Variable(
  85. name: a
  86. )
  87. 2: Scalar_EncapsedStringPart(
  88. value: and
  89. )
  90. 3: Expr_PropertyFetch(
  91. var: Expr_Variable(
  92. name: b
  93. )
  94. name: Identifier(
  95. name: c
  96. )
  97. )
  98. 4: Scalar_EncapsedStringPart(
  99. value: test
  100. )
  101. )
  102. )
  103. )
  104. 6: Stmt_Expression(
  105. expr: Scalar_String(
  106. value: Binary
  107. )
  108. )
  109. )