xref: /PHP-8.2/ext/mbstring/tests/bug43993.phpt (revision 39131219)
1--TEST--
2Bug #43993 (mb_substr_count() behaves differently to substr_count() with overlapping needles)
3--EXTENSIONS--
4mbstring
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