if.test 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. stmts: array(
  19. )
  20. elseifs: array(
  21. 0: Stmt_ElseIf(
  22. cond: Expr_Variable(
  23. name: b
  24. )
  25. stmts: array(
  26. )
  27. )
  28. 1: Stmt_ElseIf(
  29. cond: Expr_Variable(
  30. name: c
  31. )
  32. stmts: array(
  33. )
  34. )
  35. )
  36. else: Stmt_Else(
  37. stmts: array(
  38. )
  39. )
  40. cond: Expr_Variable(
  41. name: a
  42. )
  43. )
  44. 1: Stmt_If(
  45. stmts: array(
  46. )
  47. elseifs: array(
  48. )
  49. else: null
  50. cond: Expr_Variable(
  51. name: a
  52. )
  53. )
  54. 2: Stmt_If(
  55. stmts: array(
  56. )
  57. elseifs: array(
  58. 0: Stmt_ElseIf(
  59. cond: Expr_Variable(
  60. name: b
  61. )
  62. stmts: array(
  63. )
  64. )
  65. 1: Stmt_ElseIf(
  66. cond: Expr_Variable(
  67. name: c
  68. )
  69. stmts: array(
  70. )
  71. )
  72. )
  73. else: Stmt_Else(
  74. stmts: array(
  75. )
  76. )
  77. cond: Expr_Variable(
  78. name: a
  79. )
  80. )
  81. 3: Stmt_If(
  82. stmts: array(
  83. )
  84. elseifs: array(
  85. )
  86. else: null
  87. cond: Expr_Variable(
  88. name: a
  89. )
  90. )
  91. )