switch.test 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Switch
  2. -----
  3. <?php
  4. switch ($a) {
  5. case 0:
  6. break;
  7. // Comment
  8. case 1;
  9. default:
  10. }
  11. // alternative syntax
  12. switch ($a):
  13. endswitch;
  14. // leading semicolon
  15. switch ($a) { ; }
  16. switch ($a): ; endswitch;
  17. -----
  18. array(
  19. 0: Stmt_Switch(
  20. cond: Expr_Variable(
  21. name: a
  22. )
  23. cases: array(
  24. 0: Stmt_Case(
  25. cond: Scalar_LNumber(
  26. value: 0
  27. )
  28. stmts: array(
  29. 0: Stmt_Break(
  30. num: null
  31. )
  32. )
  33. )
  34. 1: Stmt_Case(
  35. cond: Scalar_LNumber(
  36. value: 1
  37. )
  38. stmts: array(
  39. )
  40. comments: array(
  41. 0: // Comment
  42. )
  43. )
  44. 2: Stmt_Case(
  45. cond: null
  46. stmts: array(
  47. )
  48. )
  49. )
  50. )
  51. 1: Stmt_Switch(
  52. cond: Expr_Variable(
  53. name: a
  54. )
  55. cases: array(
  56. )
  57. comments: array(
  58. 0: // alternative syntax
  59. )
  60. )
  61. 2: Stmt_Switch(
  62. cond: Expr_Variable(
  63. name: a
  64. )
  65. cases: array(
  66. )
  67. comments: array(
  68. 0: // leading semicolon
  69. )
  70. )
  71. 3: Stmt_Switch(
  72. cond: Expr_Variable(
  73. name: a
  74. )
  75. cases: array(
  76. )
  77. )
  78. )