php-src/ext/mbstring/tests/mb_ereg_search.phpt
2012-10-10 10:27:49 +08:00

40 lines
796 B
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--TEST--
Testing mb_ereg_search() function
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
function_exists('mb_ereg_search') or die("skip mb_ereg_search() is not available in this build");
?>
--FILE--
<?php
$str = "中国abc + abc ?!字符 china string";
$reg = "\w+";
mb_regex_encoding("UTF-8");
mb_ereg_search_init($str, $reg);
$r = mb_ereg_search();
if(!$r)
{
echo "null\n";
}
else
{
$r = mb_ereg_search_getregs(); //get first result
do
{
var_dump($r[0]);
$r = mb_ereg_search_regs();//get next result
}
while($r);
}
?>
--EXPECT--
string(9) "中国abc"
string(3) "abc"
string(6) "字符"
string(5) "china"
string(6) "string"