xref: /PHP-7.1/ext/mbstring/tests/bug43993.phpt (revision 98b57957)
1--TEST--
2Bug #43993 (mb_substr_count() behaves differently to substr_count() with overlapping needles)
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5--FILE--
6<?php
7var_dump(mb_substr_count("abcabcabca", "abcabc"));
8var_dump(mb_substr_count("abcabcabca", "abc"));
9var_dump(mb_substr_count("abcabcabca", "cab"));
10var_dump(mb_substr_count("abcabcabca", "bca"));
11var_dump(mb_substr_count("ababababab", "ba"));
12var_dump(mb_substr_count("ababababab", "ab"));
13var_dump(mb_substr_count("ababababab", "bc"));
14var_dump(mb_substr_count("aaaaaaaaaa", "a"));
15var_dump(mb_substr_count("aaaaaaaaaa", "b"));
16?>
17--EXPECT--
18int(1)
19int(3)
20int(2)
21int(3)
22int(4)
23int(5)
24int(0)
25int(10)
26int(0)
27