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-- Multibyte string 1 --\n";
26$needle1 = base64_decode('44CC');
27var_dump(mb_strrpos($string_mb, $needle1));
28
29echo "\n-- Multibyte string 2 --\n";
30$needle2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
31var_dump(mb_strrpos($string_mb, $needle2));
32
33echo "Done";
34?>
35--EXPECT--
36*** Testing mb_strrpos() : basic ***
37
38-- ASCII string 1 --
39int(15)
40
41-- ASCII string 2 --
42bool(false)
43
44-- Multibyte string 1 --
45int(20)
46
47-- Multibyte string 2 --
48bool(false)
49Done
50