1--TEST--
2Test mb_stristr() function : usage variation - multiple needles
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7echo "*** Testing mb_stristr() : 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_stristr($string_ascii, $needle_ascii_upper, false)));
25var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_upper, true)));
26var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_lower, false)));
27var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_lower, true)));
28var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_mixed, false)));
29var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_mixed, true)));
30
31
32echo "\n-- Multibyte string: needle exists --\n";
33var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_upper, false)));
34var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_upper, true)));
35var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_lower, false)));
36var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_lower, true)));
37var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_mixed, false)));
38var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_mixed, true)));
39
40?>
41--EXPECT--
42*** Testing mb_stristr() : basic functionality ***
43
44-- ASCII string: needle exists --
45string(24) "6263446566207a4263447978"
46string(2) "61"
47string(24) "6263446566207a4263447978"
48string(2) "61"
49string(24) "6263446566207a4263447978"
50string(2) "61"
51
52-- Multibyte string: needle exists --
53string(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
54string(8) "cebacebb"
55string(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
56string(8) "cebacebb"
57string(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
58string(8) "cebacebb"
59