1--TEST--
2Test iconv_strpos() function : basic functionality
3--SKIPIF--
4<?php
5extension_loaded('iconv') or die('skip');
6function_exists('iconv_strpos') or die("skip iconv_strpos() 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_strpos with ASCII and multibyte characters
14 */
15
16echo "*** Testing iconv_strpos() : basic functionality***\n";
17
18iconv_set_encoding("internal_encoding", "UTF-8");
19
20$string_ascii = 'abc def';
21//Japanese string in UTF-8
22$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
23
24echo "\n-- ASCII string 1 --\n";
25var_dump(iconv_strpos($string_ascii, 'd', 2, 'ISO-8859-1'));
26
27echo "\n-- ASCII string 2 --\n";
28var_dump(iconv_strpos($string_ascii, '123'));
29
30echo "\n-- Multibyte string 1 --\n";
31$needle1 = base64_decode('5pel5pys6Kqe');
32var_dump(iconv_strpos($string_mb, $needle1));
33
34echo "\n-- Multibyte string 2 --\n";
35$needle2 = base64_decode("44GT44KT44Gr44Gh44Gv44CB5LiW55WM");
36var_dump(iconv_strpos($string_mb, $needle2));
37
38echo "Done";
39?>
40--EXPECT--
41*** Testing iconv_strpos() : basic functionality***
42
43-- ASCII string 1 --
44int(4)
45
46-- ASCII string 2 --
47bool(false)
48
49-- Multibyte string 1 --
50int(0)
51
52-- Multibyte string 2 --
53bool(false)
54Done
55