1--TEST-- 2Test mb_strrchr() function : variation - multiple needles 3--EXTENSIONS-- 4mbstring 5--FILE-- 6<?php 7echo "*** Testing mb_strrchr() : variation ***\n"; 8 9mb_internal_encoding('UTF-8'); 10 11//with repeated needles 12$string_ascii = 'abcdef zbcdyx'; 13$needle_ascii = "bcd"; 14 15//Japanese string in UTF-8 with repeated needles 16$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OIMzTvvJXvvJbml6XmnKzoqp7jg4bjgq3jgrnjg4g='); 17$needle_mb = base64_decode('6Kqe44OG44Kt'); 18 19echo "-- Ascii data --\n"; 20var_dump(bin2hex(mb_strrchr($string_ascii, $needle_ascii, false))); 21var_dump(bin2hex(mb_strrchr($string_ascii, $needle_ascii, true))); 22 23echo "-- mb data in utf-8 --\n"; 24$res = mb_strrchr($string_mb, $needle_mb, false); 25if ($res !== false) { 26 var_dump(bin2hex($res)); 27} 28else { 29 echo "nothing found!\n"; 30} 31$res = mb_strrchr($string_mb, $needle_mb, true); 32if ($res !== false) { 33 var_dump(bin2hex($res)); 34} 35else { 36 echo "nothing found!\n"; 37} 38 39 40?> 41--EXPECT-- 42*** Testing mb_strrchr() : variation *** 43-- Ascii data -- 44string(10) "6263647978" 45string(16) "616263646566207a" 46-- mb data in utf-8 -- 47string(30) "e8aa9ee38386e382ade382b9e38388" 48string(70) "e697a5e69cace8aa9ee38386e382ade382b9e383883334efbc95efbc96e697a5e69cac" 49