菜谱项目

if.test 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. If/Elseif/Else
  2. -----
  3. <?php
  4. if ($a) {}
  5. elseif ($b) {}
  6. elseif ($c) {}
  7. else {}
  8. if ($a) {} // without else
  9. if ($a):
  10. elseif ($b):
  11. elseif ($c):
  12. else :
  13. endif;
  14. if ($a): endif; // without else
  15. -----
  16. array(
  17. 0: Stmt_If(
  18. cond: Expr_Variable(
  19. name: a
  20. )
  21. stmts: array(
  22. )
  23. elseifs: array(
  24. 0: Stmt_ElseIf(
  25. cond: Expr_Variable(
  26. name: b
  27. )
  28. stmts: array(
  29. )
  30. )
  31. 1: Stmt_ElseIf(
  32. cond: Expr_Variable(
  33. name: c
  34. )
  35. stmts: array(
  36. )
  37. )
  38. )
  39. else: Stmt_Else(
  40. stmts: array(
  41. )
  42. )
  43. )
  44. 1: Stmt_If(
  45. cond: Expr_Variable(
  46. name: a
  47. )
  48. stmts: array(
  49. )
  50. elseifs: array(
  51. )
  52. else: null
  53. )
  54. 2: Stmt_If(
  55. cond: Expr_Variable(
  56. name: a
  57. )
  58. stmts: array(
  59. )
  60. elseifs: array(
  61. 0: Stmt_ElseIf(
  62. cond: Expr_Variable(
  63. name: b
  64. )
  65. stmts: array(
  66. )
  67. )
  68. 1: Stmt_ElseIf(
  69. cond: Expr_Variable(
  70. name: c
  71. )
  72. stmts: array(
  73. )
  74. )
  75. )
  76. else: Stmt_Else(
  77. stmts: array(
  78. )
  79. )
  80. comments: array(
  81. 0: // without else
  82. )
  83. )
  84. 3: Stmt_If(
  85. cond: Expr_Variable(
  86. name: a
  87. )
  88. stmts: array(
  89. )
  90. elseifs: array(
  91. )
  92. else: null
  93. )
  94. 4: Stmt_Nop(
  95. comments: array(
  96. 0: // without else
  97. )
  98. )
  99. )