1--TEST-- 2Test mb_strrichr() function : basic functionality 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$string_ascii = 'abcdef'; 15$needle_ascii_upper = "BCD"; 16$needle_ascii_mixed = "bCd"; 17$needle_ascii_lower = "bcd"; 18 19//Greek string in lower case UTF-8 20$string_mb = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J'); 21$needle_mb_upper = base64_decode('zpzOnc6ezp8='); 22$needle_mb_lower = base64_decode('zrzOvc6+zr8='); 23$needle_mb_mixed = base64_decode('zpzOnc6+zr8='); 24 25echo "\n-- ASCII string: needle exists --\n"; 26var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_upper, false, 'ISO-8859-1'))); 27var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower))); 28var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, true))); 29 30 31echo "\n-- ASCII string: needle doesn't exist --\n"; 32var_dump(mb_strrichr($string_ascii, '123')); 33 34echo "\n-- Multibyte string: needle exists --\n"; 35var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper))); 36var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, false, 'utf-8'))); 37var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, true))); 38 39 40echo "\n-- Multibyte string: needle doesn't exist --\n"; 41$needle2 = base64_decode('zrzOvs6/'); 42var_dump(mb_strrichr($string_mb, $needle2)); 43 44?> 45--EXPECT-- 46*** Testing mb_strrichr() : basic functionality *** 47 48-- ASCII string: needle exists -- 49string(10) "6263646566" 50string(10) "6263646566" 51string(2) "61" 52 53-- ASCII string: needle doesn't exist -- 54bool(false) 55 56-- Multibyte string: needle exists -- 57string(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89" 58string(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89" 59string(44) "ceb1ceb2ceb3ceb4ceb5ceb6ceb7ceb8ceb9cebacebb" 60 61-- Multibyte string: needle doesn't exist -- 62bool(false) 63