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