1--TEST-- 2Test mb_strrichr() function : usage variation - multiple needles 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build"); 7?> 8--FILE-- 9<?php 10echo "*** Testing mb_strrichr() : 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_strrichr($string_ascii, $needle_ascii_upper, false))); 28var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_upper, true))); 29var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower, false))); 30var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower, true))); 31var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, false))); 32var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, true))); 33 34 35echo "\n-- Multibyte string: needle exists --\n"; 36var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper, false))); 37var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper, true))); 38var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, false))); 39var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, true))); 40var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, false))); 41var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, true))); 42 43?> 44--EXPECT-- 45*** Testing mb_strrichr() : basic functionality *** 46 47-- ASCII string: needle exists -- 48string(10) "4263447978" 49string(16) "616263446566207a" 50string(10) "4263447978" 51string(16) "616263446566207a" 52string(10) "4263447978" 53string(16) "616263446566207a" 54 55-- Multibyte string: needle exists -- 56string(20) "ce9cce9dcebecebfcea0" 57string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb" 58string(20) "ce9cce9dcebecebfcea0" 59string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb" 60string(20) "ce9cce9dcebecebfcea0" 61string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb" 62