1--TEST--
2Test mb_strrichr() function : usage variation - multiple needles
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7echo "*** Testing mb_strrichr() : basic functionality ***\n";
8
9mb_internal_encoding('UTF-8');
10
11//ascii mixed case, multiple needles
12$string_ascii = 'abcDef zBcDyx';
13$needle_ascii_upper = "BCD";
14$needle_ascii_mixed = "bCd";
15$needle_ascii_lower = "bcd";
16
17//Greek string in mixed case UTF-8 with multiple needles
18$string_mb = base64_decode('zrrOu868zr3Ovs6fzqDOoSDOus67zpzOnc6+zr/OoA==');
19$needle_mb_upper = base64_decode('zpzOnc6ezp8=');
20$needle_mb_lower = base64_decode('zrzOvc6+zr8=');
21$needle_mb_mixed = base64_decode('zpzOnc6+zr8=');
22
23echo "\n-- ASCII string: needle exists --\n";
24var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_upper, false)));
25var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_upper, true)));
26var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower, false)));
27var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower, true)));
28var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, false)));
29var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, true)));
30
31
32echo "\n-- Multibyte string: needle exists --\n";
33var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper, false)));
34var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper, true)));
35var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, false)));
36var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, true)));
37var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, false)));
38var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, true)));
39
40?>
41--EXPECT--
42*** Testing mb_strrichr() : basic functionality ***
43
44-- ASCII string: needle exists --
45string(10) "4263447978"
46string(16) "616263446566207a"
47string(10) "4263447978"
48string(16) "616263446566207a"
49string(10) "4263447978"
50string(16) "616263446566207a"
51
52-- Multibyte string: needle exists --
53string(20) "ce9cce9dcebecebfcea0"
54string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
55string(20) "ce9cce9dcebecebfcea0"
56string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
57string(20) "ce9cce9dcebecebfcea0"
58string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
59