switch.test 1.2 KB

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