041.phpt 448 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Match expression with trailing comma in condition list
  3. --FILE--
  4. <?php
  5. function print_bool($bool) {
  6. echo match ($bool) {
  7. false,
  8. 0,
  9. => "false\n",
  10. true,
  11. 1,
  12. => "true\n",
  13. default,
  14. => "not bool\n",
  15. };
  16. }
  17. print_bool(false);
  18. print_bool(0);
  19. print_bool(true);
  20. print_bool(1);
  21. print_bool(2);
  22. print_bool('foo');
  23. ?>
  24. --EXPECT--
  25. false
  26. false
  27. true
  28. true
  29. not bool
  30. not bool