switch.test 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. )
  50. 2: Stmt_Switch(
  51. cond: Expr_Variable(
  52. name: a
  53. )
  54. cases: array(
  55. )
  56. )
  57. 3: Stmt_Switch(
  58. cond: Expr_Variable(
  59. name: a
  60. )
  61. cases: array(
  62. )
  63. )
  64. )