split_variation_004.phpt 939 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Test split() function : usage variations - out-of-range values for limit
  3. --FILE--
  4. <?php
  5. /* Prototype : proto array split(string pattern, string string [, int limit])
  6. * Description: Split string into array by regular expression
  7. * Source code: ext/standard/reg.c
  8. * Alias to functions:
  9. */
  10. function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
  11. echo "Error: $err_no - $err_msg, $filename($linenum)\n";
  12. }
  13. set_error_handler('test_error_handler');
  14. echo "*** Testing split() : usage variations ***\n";
  15. $pattern = '[[:space:]]';
  16. $string = '1 2 3 4 5';
  17. var_dump(split($pattern, $string, 0));
  18. var_dump(split($pattern, $string, -10));
  19. echo "Done";
  20. ?>
  21. --EXPECTF--
  22. *** Testing split() : usage variations ***
  23. Error: 8192 - Function split() is deprecated, %s(16)
  24. array(1) {
  25. [0]=>
  26. string(9) "1 2 3 4 5"
  27. }
  28. Error: 8192 - Function split() is deprecated, %s(17)
  29. array(1) {
  30. [0]=>
  31. string(9) "1 2 3 4 5"
  32. }
  33. Done