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