040.phpt 578 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Test match with mixed int/string jumptable
  3. --FILE--
  4. <?php
  5. function test($value) {
  6. echo match ($value) {
  7. 1 => '1 int',
  8. '1' => '1 string',
  9. 2 => '2 int',
  10. '2' => '2 string',
  11. 3 => '3 int',
  12. '3' => '3 string',
  13. 4 => '4 int',
  14. '4' => '4 string',
  15. 5 => '5 int',
  16. '5' => '5 string',
  17. };
  18. echo "\n";
  19. }
  20. test(1);
  21. test('1');
  22. test(2);
  23. test('2');
  24. test(3);
  25. test('3');
  26. test(4);
  27. test('4');
  28. test(5);
  29. test('5');
  30. ?>
  31. --EXPECT--
  32. 1 int
  33. 1 string
  34. 2 int
  35. 2 string
  36. 3 int
  37. 3 string
  38. 4 int
  39. 4 string
  40. 5 int
  41. 5 string