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