1--TEST--
2Test iconv_strpos() function : basic functionality
3--EXTENSIONS--
4iconv
5--INI--
6error_reporting=E_ALL & ~E_DEPRECATED
7--FILE--
8<?php
9/*
10 * Test basic functionality of iconv_strpos with ASCII and multibyte characters
11 */
12
13echo "*** Testing iconv_strpos() : basic functionality***\n";
14
15iconv_set_encoding("internal_encoding", "UTF-8");
16
17$string_ascii = 'abc def';
18//Japanese string in UTF-8
19$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
20
21echo "\n-- ASCII string 1 --\n";
22var_dump(iconv_strpos($string_ascii, 'd', 2, 'ISO-8859-1'));
23
24echo "\n-- ASCII string 2 --\n";
25var_dump(iconv_strpos($string_ascii, '123'));
26
27echo "\n-- Multibyte string 1 --\n";
28$needle1 = base64_decode('5pel5pys6Kqe');
29var_dump(iconv_strpos($string_mb, $needle1));
30
31echo "\n-- Multibyte string 2 --\n";
32$needle2 = base64_decode("44GT44KT44Gr44Gh44Gv44CB5LiW55WM");
33var_dump(iconv_strpos($string_mb, $needle2));
34
35echo "Done";
36?>
37--EXPECT--
38*** Testing iconv_strpos() : basic functionality***
39
40-- ASCII string 1 --
41int(4)
42
43-- ASCII string 2 --
44bool(false)
45
46-- Multibyte string 1 --
47int(0)
48
49-- Multibyte string 2 --
50bool(false)
51Done
52