mb_split.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --TEST--
  2. mb_split()
  3. --SKIPIF--
  4. <?php
  5. extension_loaded('mbstring') or die('skip mbstring not available');
  6. function_exists('mb_split') or die("skip mb_split() is not available in this build");
  7. ?>
  8. --INI--
  9. mbstring.func_overload=0
  10. --FILE--
  11. <?php
  12. mb_regex_set_options( '' );
  13. mb_regex_encoding( 'EUC-JP' );
  14. function verify_split( $spliton, $str, $count = 0 )
  15. {
  16. $result1 = mb_split( $spliton, $str, $count );
  17. $result2 = split( $spliton, $str, $count );
  18. if ( $result1 == $result2 ) {
  19. print "ok\n";
  20. } else {
  21. print count($result1).'-'.count($result2)."\n";
  22. }
  23. }
  24. var_dump( mb_split( b" ", b"a b c d e f g" )
  25. == mb_split( b"[[:space:]]", b"a\nb\tc\nd e f g" ) );
  26. for ( $i = 0; $i < 5; ++$i ) {
  27. verify_split( b" ", b"a\tb\tc\td e\tf g", $i );
  28. }
  29. for ( $i = 1; $i < 5; ++$i ) {
  30. verify_split( b"\xa1\xa1+", b"\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i );
  31. }
  32. ?>
  33. --EXPECTF--
  34. bool(true)
  35. Deprecated: Function split() is deprecated in %s on line %d
  36. ok
  37. Deprecated: Function split() is deprecated in %s on line %d
  38. ok
  39. Deprecated: Function split() is deprecated in %s on line %d
  40. ok
  41. Deprecated: Function split() is deprecated in %s on line %d
  42. ok
  43. Deprecated: Function split() is deprecated in %s on line %d
  44. ok
  45. Deprecated: Function split() is deprecated in %s on line %d
  46. ok
  47. Deprecated: Function split() is deprecated in %s on line %d
  48. 2-2
  49. Deprecated: Function split() is deprecated in %s on line %d
  50. 3-3
  51. Deprecated: Function split() is deprecated in %s on line %d
  52. 4-4