xref: /PHP-8.0/ext/intl/tests/grapheme_empty.phpt (revision 7af24eae)
1--TEST--
2Test grapheme_strpos-alike functions with empty needle
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7
8ini_set("intl.error_level", E_WARNING);
9
10var_dump(grapheme_strpos("abc", ""));
11var_dump(grapheme_strpos("abc", "", -1));
12var_dump(grapheme_stripos("abc", ""));
13var_dump(grapheme_stripos("abc", "", -1));
14var_dump(grapheme_strrpos("abc", ""));
15var_dump(grapheme_strrpos("abc", "", -1));
16var_dump(grapheme_strripos("abc", ""));
17var_dump(grapheme_strripos("abc", "", 1));
18var_dump(grapheme_strstr("abc", ""));
19var_dump(grapheme_strstr("abc", "", true));
20var_dump(grapheme_stristr("abc", ""));
21var_dump(grapheme_stristr("abc", "", true));
22var_dump(grapheme_strpos("äbc", ""));
23var_dump(grapheme_strpos("äbc", "", -1));
24var_dump(grapheme_stripos("äbc", ""));
25var_dump(grapheme_stripos("äbc", "", -1));
26var_dump(grapheme_strrpos("äbc", ""));
27var_dump(grapheme_strrpos("äbc", "", -1));
28var_dump(grapheme_strripos("äbc", ""));
29var_dump(grapheme_strripos("äbc", "", 1));
30var_dump(grapheme_strstr("äbc", ""));
31var_dump(grapheme_strstr("äbc", "", true));
32var_dump(grapheme_stristr("äbc", ""));
33var_dump(grapheme_stristr("äbc", "", true));
34
35?>
36--EXPECT--
37int(0)
38int(2)
39int(0)
40int(2)
41int(3)
42int(2)
43int(3)
44int(3)
45string(3) "abc"
46string(0) ""
47string(3) "abc"
48string(0) ""
49int(0)
50int(2)
51int(0)
52int(2)
53int(3)
54int(2)
55int(3)
56int(3)
57string(4) "äbc"
58string(0) ""
59string(4) "äbc"
60string(0) ""
61