summaryrefslogtreecommitdiff
path: root/ext/mbstring/tests/022.inc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mbstring/tests/022.inc')
-rw-r--r--ext/mbstring/tests/022.inc25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/mbstring/tests/022.inc b/ext/mbstring/tests/022.inc
new file mode 100644
index 0000000000..800a8797d1
--- /dev/null
+++ b/ext/mbstring/tests/022.inc
@@ -0,0 +1,25 @@
+<?php
+ mb_regex_encoding( 'EUC-JP' );
+
+ function verify_split( $spliton, $str, $count = 0 )
+ {
+ $result1 = mb_split( $spliton, $str, $count );
+ $result2 = split( $spliton, $str, $count );
+ if ( $result1 == $result2 ) {
+ print "ok\n";
+ } else {
+ print count($result1).'-'.count($result2)."\n";
+ }
+ }
+
+ var_dump( mb_split( " ", "a b c d e f g" )
+ == mb_split( "[[:space:]]", "a\nb\tc\nd e f g" ) );
+
+ for ( $i = 0; $i < 5; ++$i ) {
+ verify_split( " ", "a\tb\tc\td e\tf g", $i );
+ }
+
+ for ( $i = 1; $i < 5; ++$i ) {
+ verify_split( "\xa1\xa1+", "\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i );
+ }
+?>