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