1--TEST-- 2Test mb_strrpos() function : basic functionality 3--EXTENSIONS-- 4mbstring 5--FILE-- 6<?php 7/* 8 * Test basic functionality of mb_strrpos() 9 */ 10 11echo "*** Testing mb_strrpos() : basic ***\n"; 12 13mb_internal_encoding('UTF-8'); 14 15$string_ascii = 'This is an English string. 0123456789.'; 16//Japanese string in UTF-8 17$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); 18 19echo "\n-- ASCII string 1 --\n"; 20var_dump(mb_strrpos($string_ascii, 'is', 4, 'ISO-8859-1')); 21 22echo "\n-- ASCII string 2 --\n"; 23var_dump(mb_strrpos($string_ascii, 'hello, world')); 24 25echo "\n-- ASCII string with negative offset --\n"; 26var_dump(mb_strrpos($string_ascii, 'hello', -1, 'ISO-8859-1')); 27 28echo "\n-- Multibyte string 1 --\n"; 29$needle1 = base64_decode('44CC'); 30var_dump(mb_strrpos($string_mb, $needle1)); 31 32echo "\n-- Multibyte string 2 --\n"; 33$needle2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM'); 34var_dump(mb_strrpos($string_mb, $needle2)); 35 36echo "Done"; 37?> 38--EXPECT-- 39*** Testing mb_strrpos() : basic *** 40 41-- ASCII string 1 -- 42int(15) 43 44-- ASCII string 2 -- 45bool(false) 46 47-- ASCII string with negative offset -- 48bool(false) 49 50-- Multibyte string 1 -- 51int(20) 52 53-- Multibyte string 2 -- 54bool(false) 55Done 56