xref: /PHP-8.3/ext/intl/tests/gh7734.phpt (revision e706d024)
1--TEST--
2GH-7734 (IntlPartsIterator key is wrong for KEY_LEFT/KEY_RIGHT)
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7
8$iter = \IntlBreakIterator::createCodePointInstance();
9$iter->setText('ABC');
10
11foreach ($iter->getPartsIterator(\IntlPartsIterator::KEY_SEQUENTIAL) as $key => $value) {
12    var_dump($key, $value);
13}
14
15foreach ($iter->getPartsIterator(\IntlPartsIterator::KEY_LEFT) as $key => $value) {
16    var_dump($key, $value);
17}
18
19foreach ($iter->getPartsIterator(\IntlPartsIterator::KEY_RIGHT) as $key => $value) {
20    var_dump($key, $value);
21}
22
23?>
24--EXPECT--
25int(0)
26string(1) "A"
27int(1)
28string(1) "B"
29int(2)
30string(1) "C"
31int(0)
32string(1) "A"
33int(1)
34string(1) "B"
35int(2)
36string(1) "C"
37int(1)
38string(1) "A"
39int(2)
40string(1) "B"
41int(3)
42string(1) "C"
43