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. 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. )
  81. 3: Stmt_If(
  82. cond: Expr_Variable(
  83. name: a
  84. )
  85. stmts: array(
  86. )
  87. elseifs: array(
  88. )
  89. else: null
  90. )
  91. )