1--TEST-- 2Test mb_strrpos() function : basic functionality 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* 11 * Test basic functionality of mb_strrpos() 12 */ 13 14echo "*** Testing mb_strrpos() : basic ***\n"; 15 16mb_internal_encoding('UTF-8'); 17 18$string_ascii = 'This is an English string. 0123456789.'; 19//Japanese string in UTF-8 20$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); 21 22echo "\n-- ASCII string 1 --\n"; 23var_dump(mb_strrpos($string_ascii, 'is', 4, 'ISO-8859-1')); 24 25echo "\n-- ASCII string 2 --\n"; 26var_dump(mb_strrpos($string_ascii, 'hello, world')); 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-- Multibyte string 1 -- 48int(20) 49 50-- Multibyte string 2 -- 51bool(false) 52Done 53