1--TEST--
2Test mb_substr_count() function : basic functionality
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip');
6function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
7?>
8--FILE--
9<?php
10/*
11 * Test Basic functionality of mb_substr_count
12 */
13
14echo "*** Testing mb_substr_count() : basic functionality ***\n";
15
16$string_ascii = 'This is an English string. 0123456789.';
17
18$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
19$needle_mb1 = base64_decode('44CC');
20$needle_mb2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
21
22echo "\n-- ASCII String --\n";
23var_dump(mb_substr_count($string_ascii, 'is'));
24var_dump(mb_substr_count($string_ascii, 'hello, world'));
25
26echo "\n-- Multibyte String --\n";
27var_dump(mb_substr_count($string_mb, $needle_mb1));
28var_dump(mb_substr_count($string_mb, $needle_mb2));
29
30echo "Done";
31?>
32--EXPECT--
33*** Testing mb_substr_count() : basic functionality ***
34
35-- ASCII String --
36int(3)
37int(0)
38
39-- Multibyte String --
40int(2)
41int(0)
42Done
43