mirror of
https://github.com/php/php-src.git
synced 2024-10-14 04:52:33 +00:00
26 lines
645 B
PHP
26 lines
645 B
PHP
|
<?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 );
|
||
|
}
|
||
|
?>
|