1--TEST--
2Test mb_strrchr() function : with empty needle
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip');
6function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
7?>
8--FILE--
9<?php
10
11mb_internal_encoding('UTF-8');
12
13$string_ascii = 'abc def';
14// Japanese string in UTF-8
15$string_mb = "日本語テキストです。0123456789。";
16
17echo "\n-- ASCII string --\n";
18var_dump(mb_strrchr($string_ascii, '', false, 'ISO-8859-1'));
19var_dump(mb_strrchr($string_ascii, ''));
20var_dump(mb_strrchr($string_ascii, '', true));
21
22echo "\n-- Multibyte string --\n";
23var_dump(mb_strrchr($string_mb, ''));
24var_dump(mb_strrchr($string_mb, '', false, 'utf-8'));
25var_dump(mb_strrchr($string_mb, '', true));
26
27?>
28--EXPECT--
29-- ASCII string --
30string(0) ""
31string(0) ""
32string(7) "abc def"
33
34-- Multibyte string --
35string(0) ""
36string(0) ""
37string(53) "日本語テキストです。0123456789。"
38