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