Annotation of embedaddon/php/ext/intl/tests/grapheme.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: grapheme()
3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5: --FILE--
6: <?php
7:
8: /*
9: * Test grapheme functions (procedural only)
10: */
11:
12: function ut_main()
13: {
14: $res_str = '';
15:
16: $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
17: $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
18: $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
19: $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6)
20:
21: $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
22: $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
23:
24: $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
25: $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
26:
27: $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
28:
29: $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
30:
31: $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
32:
33: // the word 'hindi' using Devanagari characters:
34: $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80";
35:
36: $char_a_ring_nfd = "a\xCC\x8A";
37: $char_A_ring_nfd = "A\xCC\x8A";
38: $char_o_diaeresis_nfd = "o\xCC\x88";
39: $char_O_diaeresis_nfd = "O\xCC\x88";
40: $char_diaeresis = "\xCC\x88";
41:
42: //=====================================================================================
43: $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n";
44:
45:
46: $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n";
47: $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n";
48: $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n";
49: $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n";
50: $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n";
51: $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n";
52:
53:
54: //=====================================================================================
55: $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n";
56:
57: $tests = array(
58: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
59: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
60: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
61: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
62: array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
63: array( "abc", $char_a_ring_nfd, "false" ),
64: array( $char_a_ring_nfd . "bc", "a", "false" ),
65: array( "abc", "d", "false" ),
66: array( "abc", "c", 2 ),
67: array( "abc", "b", 1 ),
68: array( "abc", "a", 0 ),
69: array( "abc", "a", 0, 0 ),
70: array( "abc", "a", 1, "false" ),
71: array( "ababc", "a", 1, 2 ),
72: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
73: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
74:
75: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
76: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
77: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
78: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
79: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
80: array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
81: array( "abc", $char_a_ring_nfd . "bc", "false" ),
82: array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
83: array( "abc", "defghijklmnopq", "false" ),
84: array( "abc", "ab", 0 ),
85: array( "abc", "bc", 1 ),
86: array( "abc", "abc", 0 ),
87: array( "abc", "abcd", "false" ),
88: array( "abc", "ab", 0, 0 ),
89: array( "abc", "abc", 0, 0 ),
90: array( "abc", "abc", 1, "false" ),
91: array( "ababc", "ab", 1, 2 ),
92: array( "ababc", "abc", 1, 2 ),
93: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
94: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
95: );
96:
97: foreach( $tests as $test ) {
98: $arg1 = urlencode($test[1]);
99: $arg0 = urlencode($test[0]);
100: $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos";
101: if ( 3 == count( $test ) ) {
102: $result = grapheme_strpos($test[0], $test[1]);
103: }
104: else {
105: $res_str .= " from $test[2]";
106: $result = grapheme_strpos($test[0], $test[1], $test[2]);
107: }
108: $res_str .= " = ";
109: if ( $result === false ) {
110: $res_str .= 'false';
111: }
112: else {
113: $res_str .= $result;
114: }
115: $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
116: }
117:
118: //=====================================================================================
119: $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n";
120:
121: $tests = array(
122: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
123: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
124: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
125: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
126: array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
127: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
128: array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
129: array( "Abc", $char_a_ring_nfd, "false" ),
130: array( $char_a_ring_nfd . "bc", "A", "false" ),
131: array( "abc", "D", "false" ),
132: array( "abC", "c", 2 ),
133: array( "abc", "B", 1 ),
134: array( "Abc", "a", 0 ),
135: array( "abc", "A", 0, 0 ),
136: array( "Abc", "a", 1, "false" ),
137: array( "ababc", "A", 1, 2 ),
138:
139: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
140: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
141: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
142: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
143: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
144: array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
145: array( "abc", $char_a_ring_nfd . "BC", "false" ),
146: array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
147: array( "aBC", "Defghijklmnopq", "false" ),
148: array( "abC", "Ab", 0 ),
149: array( "aBC", "bc", 1 ),
150: array( "abC", "Abc", 0 ),
151: array( "abC", "aBcd", "false" ),
152: array( "ABc", "ab", 0, 0 ),
153: array( "aBc", "abC", 0, 0 ),
154: array( "abc", "aBc", 1, "false" ),
155: array( "ABabc", "AB", 1, 2 ),
156: array( "abaBc", "aBc", 1, 2 ),
157: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
158: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
159: );
160:
161: foreach( $tests as $test ) {
162: $arg1 = urlencode($test[1]);
163: $arg0 = urlencode($test[0]);
164: $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos";
165: if ( 3 == count( $test ) ) {
166: $result = grapheme_stripos($test[0], $test[1]);
167: }
168: else {
169: $res_str .= " from $test[2]";
170: $result = grapheme_stripos($test[0], $test[1], $test[2]);
171: }
172: $res_str .= " = ";
173: if ( $result === false ) {
174: $res_str .= 'false';
175: }
176: else {
177: $res_str .= $result;
178: }
179: $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
180: }
181:
182:
183: //=====================================================================================
184: $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n";
185:
186:
187: $tests = array(
188: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
189: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
190: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
191: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
192: array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
193: array( "abc", $char_a_ring_nfd, "false" ),
194: array( $char_a_ring_nfd . "bc", "a", "false" ),
195: array( "abc", "d", "false" ),
196: array( "abc", "c", 2 ),
197: array( "abc", "b", 1 ),
198: array( "abc", "a", 0 ),
199: array( "abc", "a", 0, 0 ),
200: array( "abc", "a", 1, "false" ),
201: array( "ababc", "a", 1, 2 ),
202: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
203: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
204:
205: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
206: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
207: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
208: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
209: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
210: array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
211: array( "abc", $char_a_ring_nfd . "bc", "false" ),
212: array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
213: array( "abc", "defghijklmnopq", "false" ),
214: array( "abc", "ab", 0 ),
215: array( "abc", "bc", 1 ),
216: array( "abc", "abc", 0 ),
217: array( "abc", "abcd", "false" ),
218: array( "abc", "ab", 0, 0 ),
219: array( "abc", "abc", 0, 0 ),
220: array( "abc", "abc", 1, "false" ),
221: array( "ababc", "ab", 1, 2 ),
222: array( "ababc", "abc", 1, 2 ),
223: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
224: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
225: );
226:
227: foreach( $tests as $test ) {
228: $arg1 = urlencode($test[1]);
229: $arg0 = urlencode($test[0]);
230: $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos";
231: if ( 3 == count( $test ) ) {
232: $result = grapheme_strrpos($test[0], $test[1]);
233: }
234: else {
235: $res_str .= " from $test[2]";
236: $result = grapheme_strrpos($test[0], $test[1], $test[2]);
237: }
238: $res_str .= " = ";
239: if ( $result === false ) {
240: $res_str .= 'false';
241: }
242: else {
243: $res_str .= $result;
244: }
245: $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
246: }
247:
248:
249: //=====================================================================================
250: $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n";
251:
252: $tests = array(
253: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
254: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
255: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
256: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
257: array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
258: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
259: array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
260: array( "Abc", $char_a_ring_nfd, "false" ),
261: array( $char_a_ring_nfd . "bc", "A", "false" ),
262: array( "abc", "D", "false" ),
263: array( "abC", "c", 2 ),
264: array( "abc", "B", 1 ),
265: array( "Abc", "a", 0 ),
266: array( "abc", "A", 0, 0 ),
267: array( "Abc", "a", 1, "false" ),
268: array( "ababc", "A", 1, 2 ),
269:
270: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
271: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
272: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
273: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
274: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
275: array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
276: array( "abc", $char_a_ring_nfd . "BC", "false" ),
277: array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
278: array( "aBC", "Defghijklmnopq", "false" ),
279: array( "abC", "Ab", 0 ),
280: array( "aBC", "bc", 1 ),
281: array( "abC", "Abc", 0 ),
282: array( "abC", "aBcd", "false" ),
283: array( "ABc", "ab", 0, 0 ),
284: array( "aBc", "abC", 0, 0 ),
285: array( "abc", "aBc", 1, "false" ),
286: array( "ABabc", "AB", 1, 2 ),
287: array( "abaBc", "aBc", 1, 2 ),
288: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
289: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
290: );
291:
292: foreach( $tests as $test ) {
293: $arg1 = urlencode($test[1]);
294: $arg0 = urlencode($test[0]);
295: $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos";
296: if ( 3 == count( $test ) ) {
297: $result = grapheme_strripos($test[0], $test[1]);
298: }
299: else {
300: $res_str .= " from $test[2]";
301: $result = grapheme_strripos($test[0], $test[1], $test[2]);
302: }
303: $res_str .= " = ";
304: if ( $result === false ) {
305: $res_str .= 'false';
306: }
307: else {
308: $res_str .= $result;
309: }
310: $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
311: }
312:
313:
314: //=====================================================================================
315: $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n";
316:
317: $tests = array(
318:
319: array( "abc", 3, "false" ),
320: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
321: array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
322: array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ),
323: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ),
324: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
325: array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ),
326: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ),
327: array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ),
328: array( "Abc", -5, "false" ),
329: array( $char_a_ring_nfd . "bc", 3, "false" ),
330: array( "abc", 4, "false" ),
331: array( "abC", 2, "C" ),
332: array( "abc", 1, "bc" ),
333: array( "Abc", 1, 1, "b" ),
334: array( "abc", 0, 2, "ab" ),
335: array( "Abc", -4, 1, "false" ),
336: array( "ababc", 1, 2, "ba" ),
337: array( "ababc", 0, 10, "ababc" ),
338:
339: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
340: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ),
341: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ),
342: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ),
343: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ),
344: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ),
345:
346: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
347: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
348: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
349: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
350: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ),
351: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ),
352: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ),
353: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ),
354: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ),
355: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ),
356:
357: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
358: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
359: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ),
360: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ),
361: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ),
362: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ),
363: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ),
364: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ),
365: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ),
366:
367: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
368: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
369: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
370: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
371: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ),
372: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ),
373: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ),
374: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ),
375: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ),
376: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ),
377:
378: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
379: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
380: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
381: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ),
382: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ),
383: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ),
384: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ),
385: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ),
386: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ),
387:
388: );
389:
390: foreach( $tests as $test ) {
391: $arg0 = urlencode($test[0]);
392: $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr";
393: if ( 3 == count( $test ) ) {
394: $result = grapheme_substr($test[0], $test[1]);
395: }
396: else {
397: $res_str .= " with length $test[2]";
398: $result = grapheme_substr($test[0], $test[1], $test[2]);
399: }
400: $res_str .= " = ";
401: if ( $result === false ) {
402: $res_str .= 'false';
403: }
404: else {
405: $res_str .= urlencode($result);
406: }
407: $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
408: }
409:
410:
411: //=====================================================================================
412: $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
413:
414: $tests = array(
415: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ),
416: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
417: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ),
418: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
419: array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
420: array( "abc", $char_a_ring_nfd, "false" ),
421: array( $char_a_ring_nfd . "bc", "a", "false" ),
422: array( "abc", "d", "false" ),
423: array( "abc", "c", "c" ),
424: array( "abc", "b", "bc" ),
425: array( "abc", "a", "abc" ),
426: array( "abc", "ab", "abc" ),
427: array( "abc", "abc", "abc" ),
428: array( "abc", "bc", "bc" ),
429: array( "abc", "a", FALSE, "abc" ),
430: array( "abc", "a", TRUE, "" ),
431: array( "abc", "b", TRUE, "a" ),
432: array( "abc", "c", TRUE, "ab" ),
433: array( "ababc", "bab", TRUE, "a" ),
434: array( "ababc", "abc", TRUE, "ab" ),
435: array( "ababc", "abc", FALSE, "abc" ),
436:
437: array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
438: array( "bc" . $char_a_ring_nfd . "a", "a", "a" ),
439: array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ),
440: array( $char_a_ring_nfd . "bc", "a", "false" ),
441: array( $char_a_ring_nfd . "abc", "ab", "abc" ),
442: array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd),
443: array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
444: array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"),
445: array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ),
446: array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ),
447: array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ),
448: array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
449: array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ),
450: array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ),
451:
452: );
453:
454: foreach( $tests as $test ) {
455: $arg1 = urlencode($test[1]);
456: $arg0 = urlencode($test[0]);
457: $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr";
458: if ( 3 == count( $test ) ) {
459: $result = grapheme_strstr($test[0], $test[1]);
460: }
461: else {
462: $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
463: $result = grapheme_strstr($test[0], $test[1], $test[2]);
464: }
465: $res_str .= " = ";
466: if ( $result === false ) {
467: $res_str .= 'false';
468: }
469: else {
470: $res_str .= urlencode($result);
471: }
472: $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
473: }
474:
475:
476: //=====================================================================================
477: $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
478:
479: $tests = array(
480: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ),
481: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ),
482: array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
483: array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
484: array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"),
485: array( "abc", $char_a_ring_nfd, "false" ),
486: array( $char_a_ring_nfd . "bc", "A", "false" ),
487: array( "abc", "d", "false" ),
488: array( "abc", "C", "c" ),
489: array( "aBc", "b", "Bc" ),
490: array( "abc", "A", "abc" ),
491: array( "abC", "ab", "abC" ),
492: array( "abc", "aBc", "abc" ),
493: array( "abC", "bc", "bC" ),
494: array( "abc", "A", FALSE, "abc" ),
495: array( "abc", "a", TRUE, "" ),
496: array( "aBc", "b", TRUE, "a" ),
497: array( "abc", "C", TRUE, "ab" ),
498: array( "aBabc", "bab", TRUE, "a" ),
499: array( "ababc", "aBc", TRUE, "ab" ),
500: array( "ababc", "abC", FALSE, "abc" ),
501:
502: array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
503: array( "bc" . $char_a_ring_nfd . "A", "a", "A" ),
504: array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ),
505: array( $char_A_ring_nfd . "bc", "a", "false" ),
506: array( $char_a_ring_nfd . "abc", "Ab", "abc" ),
507: array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd),
508: array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
509: array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ),
510: array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ),
511: array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ),
512: array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ),
513: array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
514: array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ),
515: array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ),
516:
517: );
518:
519: foreach( $tests as $test ) {
520: $arg1 = urlencode($test[1]);
521: $arg0 = urlencode($test[0]);
522: $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr";
523: if ( 3 == count( $test ) ) {
524: $result = grapheme_stristr($test[0], $test[1]);
525: }
526: else {
527: $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
528: $result = grapheme_stristr($test[0], $test[1], $test[2]);
529: }
530: $res_str .= " = ";
531: if ( $result === false ) {
532: $res_str .= 'false';
533: }
534: else {
535: $res_str .= urlencode($result);
536: }
537: $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
538: }
539:
540:
541: //=====================================================================================
542: $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n";
543:
544: $tests = array(
545: // haystack, count, [[offset], [next]], result
546: array( "abc", 3, "abc" ),
547: array( "abc", 2, "ab" ),
548: array( "abc", 1, "a" ),
549: array( "abc", 0, "" ),
550: array( "abc", 1, 0, "a" ),
551: array( "abc", 1, 1, "b" ),
552: array( "abc", 1, 2, "c" ),
553: array( "abc", 0, 2, "" ),
554:
555: array( "abc", 3, 0, 3, "abc" ),
556: array( "abc", 2, 0, 2, "ab" ),
557: array( "abc", 1, 0, 1, "a" ),
558: array( "abc", 0, 0, 0, "" ),
559: array( "abc", 1, 0, 1, "a" ),
560: array( "abc", 1, 1, 2, "b" ),
561: array( "abc", 1, 2, 3, "c" ),
562: array( "abc", 0, 2, 2, "" ),
563: array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ),
564:
565: array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ),
566: array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ),
567: array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ),
568: array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ),
569: array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ),
570: array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ),
571: array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ),
572: array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ),
573: array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ),
574:
575: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
576: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
577: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ),
578:
579: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd),
580: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd),
581: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd),
582: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis),
583:
584: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
585: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
586: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
587: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd),
588: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd),
589: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd),
590: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
591: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
592:
593: );
594:
595: $next = -1;
596: foreach( $tests as $test ) {
597: $arg0 = urlencode($test[0]);
598: $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract";
599: if ( 3 == count( $test ) ) {
600: $result = grapheme_extract($test[0], $test[1]);
601: }
602: elseif ( 4 == count ( $test ) ) {
603: $res_str .= " starting at byte position $test[2]";
604: $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]);
605: }
606: else {
607: $res_str .= " starting at byte position $test[2] with \$next";
608: $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next);
609: }
610: $res_str .= " = ";
611: if ( $result === false ) {
612: $res_str .= 'false';
613: }
614: else {
615: $res_str .= urlencode($result);
616: }
617: $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]);
618: if ( 5 == count ( $test ) ) {
619: $res_str .= " \$next=$next == $test[3] ";
620: if ( $next != $test[3] ) {
621: $res_str .= "***FAILED***";
622: }
623: }
624: $res_str .= "\n";
625: }
626:
627:
628: //=====================================================================================
629: $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n";
630:
631: $tests = array(
632: array( "abc", 3, "abc" ),
633: array( "abc", 2, "ab" ),
634: array( "abc", 1, "a" ),
635: array( "abc", 0, "" ),
636: array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ),
637: array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ),
638: array( $char_a_ring_nfd . "bc", 1, "" ),
639: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
640: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
641: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
642: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
643: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ),
644: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ),
645: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ),
646: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
647: array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ),
648:
649: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd),
650: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd),
651: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd),
652: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis),
653:
654: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
655: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
656: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
657: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd),
658: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd),
659: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd),
660: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
661: array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
662:
663: );
664:
665: foreach( $tests as $test ) {
666: $arg0 = urlencode($test[0]);
667: $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES";
668: if ( 3 == count( $test ) ) {
669: $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES);
670: }
671: else {
672: $res_str .= " starting at byte position $test[2]";
673: $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]);
674: }
675: $res_str .= " = ";
676: if ( $result === false ) {
677: $res_str .= 'false';
678: }
679: else {
680: $res_str .= urlencode($result);
681: }
682: $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
683: }
684:
685:
686: //=====================================================================================
687: $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n";
688:
689: $tests = array(
690: array( "abc", 3, "abc" ),
691: array( "abc", 2, "ab" ),
692: array( "abc", 1, "a" ),
693: array( "abc", 0, "" ),
694: array( "abc" . $char_o_diaeresis_nfd, 0, "" ),
695: array( "abc" . $char_o_diaeresis_nfd, 1, "a" ),
696: array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ),
697: array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ),
698: array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ),
699: array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd),
700: array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd),
701: array( $char_o_diaeresis_nfd . "abc", 0, "" ),
702: array( $char_o_diaeresis_nfd . "abc", 1, "" ),
703: array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ),
704: array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ),
705: array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ),
706: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ),
707: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ),
708: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ),
709: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
710:
711: array( "abc", 3, 0, "abc" ),
712: array( "abc", 2, 1, "bc" ),
713: array( "abc", 1, 2, "c" ),
714: array( "abc", 0, 3, "false" ),
715: array( "abc", 1, 3, "false" ),
716: array( "abc", 1, 999, "false" ),
717: array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ),
718: array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ),
719: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
720: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ),
721: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ),
722: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ),
723: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ),
724: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ),
725: array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ),
726:
727: );
728:
729: foreach( $tests as $test ) {
730: $arg0 = urlencode($test[0]);
731: $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS";
732: if ( 3 == count( $test ) ) {
733: $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS);
734: }
735: else {
736: $res_str .= " starting at byte position $test[2]";
737: $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]);
738: }
739: $res_str .= " = ";
740: if ( $result === false ) {
741: $res_str .= 'false';
742: }
743: else {
744: $res_str .= urlencode($result);
745: }
746: $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
747: }
748:
749:
750: //=====================================================================================
751:
752: return $res_str;
753: }
754:
755: echo ut_main();
756:
757: function check_result($result, $expected) {
758:
759: if ( $result === false ) {
760: $result = 'false';
761: }
762:
763: if ( strcmp($result, $expected) != 0 ) {
764: return " **FAILED** ";
765: }
766:
767: return "";
768: }
769:
770: ?>
771: --EXPECT--
772:
773: function grapheme_strlen($string) {}
774:
775: "hindi" in devanagari strlen 3
776: "ab" + "hindi" + "cde" strlen 8
777: "" strlen 0
778: char_a_ring_nfd strlen 1
779: char_a_ring_nfd + "bc" strlen 3
780: "abc" strlen 3
781:
782: function grapheme_strpos($haystack, $needle, $offset = 0) {}
783:
784: find "o" in "aa%CC%8Abco%CC%88o" - grapheme_strpos = 5 == 5
785: find "o" in "aa%CC%8Abco%CC%88" - grapheme_strpos = false == false
786: find "o%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_strpos = 4 == 4
787: find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strpos = 2 == 2
788: find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strpos = 1 == 1
789: find "a%CC%8A" in "abc" - grapheme_strpos = false == false
790: find "a" in "a%CC%8Abc" - grapheme_strpos = false == false
791: find "d" in "abc" - grapheme_strpos = false == false
792: find "c" in "abc" - grapheme_strpos = 2 == 2
793: find "b" in "abc" - grapheme_strpos = 1 == 1
794: find "a" in "abc" - grapheme_strpos = 0 == 0
795: find "a" in "abc" - grapheme_strpos from 0 = 0 == 0
796: find "a" in "abc" - grapheme_strpos from 1 = false == false
797: find "a" in "ababc" - grapheme_strpos from 1 = 2 == 2
798: find "o" in "aoa%CC%8Abco%CC%88o" - grapheme_strpos from 2 = 6 == 6
799: find "a%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abc" - grapheme_strpos from 2 = 3 == 3
800: find "op" in "aa%CC%8Abco%CC%88opq" - grapheme_strpos = 5 == 5
801: find "opq" in "aa%CC%8Abco%CC%88opq" - grapheme_strpos = 5 == 5
802: find "abc" in "aa%CC%8Abco%CC%88" - grapheme_strpos = false == false
803: find "o%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bco%CC%88" - grapheme_strpos = 4 == 4
804: find "a%CC%8Abc" in "o%CC%88aa%CC%8Abc" - grapheme_strpos = 2 == 2
805: find "a%CC%8Abc" in "aa%CC%8Abc" - grapheme_strpos = 1 == 1
806: find "a%CC%8Abc" in "abc" - grapheme_strpos = false == false
807: find "abcdefg" in "a%CC%8Abc" - grapheme_strpos = false == false
808: find "defghijklmnopq" in "abc" - grapheme_strpos = false == false
809: find "ab" in "abc" - grapheme_strpos = 0 == 0
810: find "bc" in "abc" - grapheme_strpos = 1 == 1
811: find "abc" in "abc" - grapheme_strpos = 0 == 0
812: find "abcd" in "abc" - grapheme_strpos = false == false
813: find "ab" in "abc" - grapheme_strpos from 0 = 0 == 0
814: find "abc" in "abc" - grapheme_strpos from 0 = 0 == 0
815: find "abc" in "abc" - grapheme_strpos from 1 = false == false
816: find "ab" in "ababc" - grapheme_strpos from 1 = 2 == 2
817: find "abc" in "ababc" - grapheme_strpos from 1 = 2 == 2
818: find "oa%CC%8Abc" in "aoa%CC%8Abco%CC%88oa%CC%8Abc" - grapheme_strpos from 2 = 6 == 6
819: find "a%CC%8Abca%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abca%CC%8Adef" - grapheme_strpos from 2 = 3 == 3
820:
821: function grapheme_stripos($haystack, $needle, $offset = 0) {}
822:
823: find "o" in "aoa%CC%8Abco%CC%88O" - grapheme_stripos from 2 = 6 == 6
824: find "a%CC%8A" in "o%CC%88a%CC%8AaA%CC%8Abc" - grapheme_stripos from 2 = 3 == 3
825: find "o" in "aa%CC%8Abco%CC%88O" - grapheme_stripos = 5 == 5
826: find "O" in "aa%CC%8Abco%CC%88" - grapheme_stripos = false == false
827: find "o%CC%88" in "aa%CC%8AbcO%CC%88" - grapheme_stripos = 4 == 4
828: find "A%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_stripos = 2 == 2
829: find "a%CC%8A" in "aA%CC%8Abc" - grapheme_stripos = 1 == 1
830: find "a%CC%8A" in "Abc" - grapheme_stripos = false == false
831: find "A" in "a%CC%8Abc" - grapheme_stripos = false == false
832: find "D" in "abc" - grapheme_stripos = false == false
833: find "c" in "abC" - grapheme_stripos = 2 == 2
834: find "B" in "abc" - grapheme_stripos = 1 == 1
835: find "a" in "Abc" - grapheme_stripos = 0 == 0
836: find "A" in "abc" - grapheme_stripos from 0 = 0 == 0
837: find "a" in "Abc" - grapheme_stripos from 1 = false == false
838: find "A" in "ababc" - grapheme_stripos from 1 = 2 == 2
839: find "oP" in "aa%CC%8Abco%CC%88Opq" - grapheme_stripos = 5 == 5
840: find "opQ" in "aa%CC%8Abco%CC%88Opq" - grapheme_stripos = 5 == 5
841: find "abc" in "aa%CC%8Abco%CC%88" - grapheme_stripos = false == false
842: find "O%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bCo%CC%88" - grapheme_stripos = 4 == 4
843: find "A%CC%8Abc" in "o%CC%88aa%CC%8ABc" - grapheme_stripos = 2 == 2
844: find "a%CC%8Abc" in "aa%CC%8ABC" - grapheme_stripos = 1 == 1
845: find "a%CC%8ABC" in "abc" - grapheme_stripos = false == false
846: find "aBCdefg" in "a%CC%8ABC" - grapheme_stripos = false == false
847: find "Defghijklmnopq" in "aBC" - grapheme_stripos = false == false
848: find "Ab" in "abC" - grapheme_stripos = 0 == 0
849: find "bc" in "aBC" - grapheme_stripos = 1 == 1
850: find "Abc" in "abC" - grapheme_stripos = 0 == 0
851: find "aBcd" in "abC" - grapheme_stripos = false == false
852: find "ab" in "ABc" - grapheme_stripos from 0 = 0 == 0
853: find "abC" in "aBc" - grapheme_stripos from 0 = 0 == 0
854: find "aBc" in "abc" - grapheme_stripos from 1 = false == false
855: find "AB" in "ABabc" - grapheme_stripos from 1 = 2 == 2
856: find "aBc" in "abaBc" - grapheme_stripos from 1 = 2 == 2
857: find "Oa%CC%8AbC" in "aoa%CC%8Abco%CC%88oA%CC%8AbC" - grapheme_stripos from 2 = 6 == 6
858: find "a%CC%8ABca%CC%8A" in "o%CC%88a%CC%8AaA%CC%8AbCa%CC%8Adef" - grapheme_stripos from 2 = 3 == 3
859:
860: function grapheme_strrpos($haystack, $needle, $offset = 0) {}
861:
862: find "o" in "aa%CC%8Abco%CC%88o" - grapheme_strrpos = 5 == 5
863: find "o" in "aa%CC%8Abco%CC%88" - grapheme_strrpos = false == false
864: find "o%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_strrpos = 4 == 4
865: find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strrpos = 2 == 2
866: find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strrpos = 1 == 1
867: find "a%CC%8A" in "abc" - grapheme_strrpos = false == false
868: find "a" in "a%CC%8Abc" - grapheme_strrpos = false == false
869: find "d" in "abc" - grapheme_strrpos = false == false
870: find "c" in "abc" - grapheme_strrpos = 2 == 2
871: find "b" in "abc" - grapheme_strrpos = 1 == 1
872: find "a" in "abc" - grapheme_strrpos = 0 == 0
873: find "a" in "abc" - grapheme_strrpos from 0 = 0 == 0
874: find "a" in "abc" - grapheme_strrpos from 1 = false == false
875: find "a" in "ababc" - grapheme_strrpos from 1 = 2 == 2
876: find "o" in "aoa%CC%8Abco%CC%88o" - grapheme_strrpos from 2 = 6 == 6
877: find "a%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abc" - grapheme_strrpos from 2 = 3 == 3
878: find "op" in "aa%CC%8Abco%CC%88opq" - grapheme_strrpos = 5 == 5
879: find "opq" in "aa%CC%8Abco%CC%88opq" - grapheme_strrpos = 5 == 5
880: find "abc" in "aa%CC%8Abco%CC%88" - grapheme_strrpos = false == false
881: find "o%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bco%CC%88" - grapheme_strrpos = 4 == 4
882: find "a%CC%8Abc" in "o%CC%88aa%CC%8Abc" - grapheme_strrpos = 2 == 2
883: find "a%CC%8Abc" in "aa%CC%8Abc" - grapheme_strrpos = 1 == 1
884: find "a%CC%8Abc" in "abc" - grapheme_strrpos = false == false
885: find "abcdefg" in "a%CC%8Abc" - grapheme_strrpos = false == false
886: find "defghijklmnopq" in "abc" - grapheme_strrpos = false == false
887: find "ab" in "abc" - grapheme_strrpos = 0 == 0
888: find "bc" in "abc" - grapheme_strrpos = 1 == 1
889: find "abc" in "abc" - grapheme_strrpos = 0 == 0
890: find "abcd" in "abc" - grapheme_strrpos = false == false
891: find "ab" in "abc" - grapheme_strrpos from 0 = 0 == 0
892: find "abc" in "abc" - grapheme_strrpos from 0 = 0 == 0
893: find "abc" in "abc" - grapheme_strrpos from 1 = false == false
894: find "ab" in "ababc" - grapheme_strrpos from 1 = 2 == 2
895: find "abc" in "ababc" - grapheme_strrpos from 1 = 2 == 2
896: find "oa%CC%8Abc" in "aoa%CC%8Abco%CC%88oa%CC%8Abc" - grapheme_strrpos from 2 = 6 == 6
897: find "a%CC%8Abca%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abca%CC%8Adef" - grapheme_strrpos from 2 = 3 == 3
898:
899: function grapheme_strripos($haystack, $needle, $offset = 0) {}
900:
901: find "o" in "aoa%CC%8Abco%CC%88O" - grapheme_strripos from 2 = 6 == 6
902: find "a%CC%8A" in "o%CC%88a%CC%8AaA%CC%8Abc" - grapheme_strripos from 2 = 3 == 3
903: find "o" in "aa%CC%8Abco%CC%88O" - grapheme_strripos = 5 == 5
904: find "O" in "aa%CC%8Abco%CC%88" - grapheme_strripos = false == false
905: find "o%CC%88" in "aa%CC%8AbcO%CC%88" - grapheme_strripos = 4 == 4
906: find "A%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strripos = 2 == 2
907: find "a%CC%8A" in "aA%CC%8Abc" - grapheme_strripos = 1 == 1
908: find "a%CC%8A" in "Abc" - grapheme_strripos = false == false
909: find "A" in "a%CC%8Abc" - grapheme_strripos = false == false
910: find "D" in "abc" - grapheme_strripos = false == false
911: find "c" in "abC" - grapheme_strripos = 2 == 2
912: find "B" in "abc" - grapheme_strripos = 1 == 1
913: find "a" in "Abc" - grapheme_strripos = 0 == 0
914: find "A" in "abc" - grapheme_strripos from 0 = 0 == 0
915: find "a" in "Abc" - grapheme_strripos from 1 = false == false
916: find "A" in "ababc" - grapheme_strripos from 1 = 2 == 2
917: find "oP" in "aa%CC%8Abco%CC%88Opq" - grapheme_strripos = 5 == 5
918: find "opQ" in "aa%CC%8Abco%CC%88Opq" - grapheme_strripos = 5 == 5
919: find "abc" in "aa%CC%8Abco%CC%88" - grapheme_strripos = false == false
920: find "O%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bCo%CC%88" - grapheme_strripos = 4 == 4
921: find "A%CC%8Abc" in "o%CC%88aa%CC%8ABc" - grapheme_strripos = 2 == 2
922: find "a%CC%8Abc" in "aa%CC%8ABC" - grapheme_strripos = 1 == 1
923: find "a%CC%8ABC" in "abc" - grapheme_strripos = false == false
924: find "aBCdefg" in "a%CC%8ABC" - grapheme_strripos = false == false
925: find "Defghijklmnopq" in "aBC" - grapheme_strripos = false == false
926: find "Ab" in "abC" - grapheme_strripos = 0 == 0
927: find "bc" in "aBC" - grapheme_strripos = 1 == 1
928: find "Abc" in "abC" - grapheme_strripos = 0 == 0
929: find "aBcd" in "abC" - grapheme_strripos = false == false
930: find "ab" in "ABc" - grapheme_strripos from 0 = 0 == 0
931: find "abC" in "aBc" - grapheme_strripos from 0 = 0 == 0
932: find "aBc" in "abc" - grapheme_strripos from 1 = false == false
933: find "AB" in "ABabc" - grapheme_strripos from 1 = 2 == 2
934: find "aBc" in "abaBc" - grapheme_strripos from 1 = 2 == 2
935: find "Oa%CC%8AbC" in "aoa%CC%8Abco%CC%88oA%CC%8AbC" - grapheme_strripos from 2 = 6 == 6
936: find "a%CC%8ABca%CC%8A" in "o%CC%88a%CC%8AaA%CC%8AbCa%CC%8Adef" - grapheme_strripos from 2 = 3 == 3
937:
938: function grapheme_substr($string, $start, $length = -1) {}
939:
940: substring of "abc" from "3" - grapheme_substr = false == false
941: substring of "aa%CC%8Abco%CC%88" from "5" - grapheme_substr = false == false
942: substring of "aoa%CC%8Abco%CC%88O" from "2" - grapheme_substr = a%CC%8Abco%CC%88O == a%CC%8Abco%CC%88O
943: substring of "o%CC%88a%CC%8AaA%CC%8Abc" from "2" - grapheme_substr = aA%CC%8Abc == aA%CC%8Abc
944: substring of "aa%CC%8Abco%CC%88O" from "5" - grapheme_substr = O == O
945: substring of "aa%CC%8Abco%CC%88" from "5" - grapheme_substr = false == false
946: substring of "aa%CC%8AbcO%CC%88" from "4" - grapheme_substr = O%CC%88 == O%CC%88
947: substring of "o%CC%88aa%CC%8Abc" from "2" - grapheme_substr = a%CC%8Abc == a%CC%8Abc
948: substring of "aA%CC%8Abc" from "1" - grapheme_substr = A%CC%8Abc == A%CC%8Abc
949: substring of "Abc" from "-5" - grapheme_substr = false == false
950: substring of "a%CC%8Abc" from "3" - grapheme_substr = false == false
951: substring of "abc" from "4" - grapheme_substr = false == false
952: substring of "abC" from "2" - grapheme_substr = C == C
953: substring of "abc" from "1" - grapheme_substr = bc == bc
954: substring of "Abc" from "1" - grapheme_substr with length 1 = b == b
955: substring of "abc" from "0" - grapheme_substr with length 2 = ab == ab
956: substring of "Abc" from "-4" - grapheme_substr with length 1 = false == false
957: substring of "ababc" from "1" - grapheme_substr with length 2 = ba == ba
958: substring of "ababc" from "0" - grapheme_substr with length 10 = ababc == ababc
959: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length 10 = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
960: substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr = Opq == Opq
961: substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -1 = Op == Op
962: substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -2 = O == O
963: substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -3 = ==
964: substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -4 = false == false
965: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
966: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -1 = aa%CC%8Abco%CC%88Op == aa%CC%8Abco%CC%88Op
967: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -2 = aa%CC%8Abco%CC%88O == aa%CC%8Abco%CC%88O
968: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -3 = aa%CC%8Abco%CC%88 == aa%CC%8Abco%CC%88
969: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -4 = aa%CC%8Abc == aa%CC%8Abc
970: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -5 = aa%CC%8Ab == aa%CC%8Ab
971: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -6 = aa%CC%8A == aa%CC%8A
972: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -7 = a == a
973: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -8 = ==
974: substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -9 = false == false
975: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
976: substring of "aa%CC%8Abco%CC%88Opq" from "-7" - grapheme_substr = a%CC%8Abco%CC%88Opq == a%CC%8Abco%CC%88Opq
977: substring of "aa%CC%8Abco%CC%88Opq" from "-6" - grapheme_substr = bco%CC%88Opq == bco%CC%88Opq
978: substring of "aa%CC%8Abco%CC%88Opq" from "-5" - grapheme_substr = co%CC%88Opq == co%CC%88Opq
979: substring of "aa%CC%8Abco%CC%88Opq" from "-4" - grapheme_substr = o%CC%88Opq == o%CC%88Opq
980: substring of "aa%CC%8Abco%CC%88Opq" from "-3" - grapheme_substr = Opq == Opq
981: substring of "aa%CC%8Abco%CC%88Opq" from "-2" - grapheme_substr = pq == pq
982: substring of "aa%CC%8Abco%CC%88Opq" from "-1" - grapheme_substr = q == q
983: substring of "aa%CC%8Abco%CC%88Opq" from "-999" - grapheme_substr = false == false
984: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 8 = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
985: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 7 = aa%CC%8Abco%CC%88Op == aa%CC%8Abco%CC%88Op
986: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 6 = aa%CC%8Abco%CC%88O == aa%CC%8Abco%CC%88O
987: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 5 = aa%CC%8Abco%CC%88 == aa%CC%8Abco%CC%88
988: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 4 = aa%CC%8Abc == aa%CC%8Abc
989: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 3 = aa%CC%8Ab == aa%CC%8Ab
990: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 2 = aa%CC%8A == aa%CC%8A
991: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 1 = a == a
992: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 0 = ==
993: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -999 = false == false
994: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -1 = aa%CC%8Abco%CC%88Op == aa%CC%8Abco%CC%88Op
995: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -2 = aa%CC%8Abco%CC%88O == aa%CC%8Abco%CC%88O
996: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -3 = aa%CC%8Abco%CC%88 == aa%CC%8Abco%CC%88
997: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -4 = aa%CC%8Abc == aa%CC%8Abc
998: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -5 = aa%CC%8Ab == aa%CC%8Ab
999: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -6 = aa%CC%8A == aa%CC%8A
1000: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -7 = a == a
1001: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -8 = ==
1002: substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -9 = false == false
1003:
1004: function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}
1005:
1006: find "o" in "aa%CC%8Abco%CC%88o" - grapheme_strstr = o == o
1007: find "o" in "aa%CC%8Abco%CC%88" - grapheme_strstr = false == false
1008: find "o%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_strstr = o%CC%88 == o%CC%88
1009: find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strstr = a%CC%8Abc == a%CC%8Abc
1010: find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strstr = a%CC%8Abc == a%CC%8Abc
1011: find "a%CC%8A" in "abc" - grapheme_strstr = false == false
1012: find "a" in "a%CC%8Abc" - grapheme_strstr = false == false
1013: find "d" in "abc" - grapheme_strstr = false == false
1014: find "c" in "abc" - grapheme_strstr = c == c
1015: find "b" in "abc" - grapheme_strstr = bc == bc
1016: find "a" in "abc" - grapheme_strstr = abc == abc
1017: find "ab" in "abc" - grapheme_strstr = abc == abc
1018: find "abc" in "abc" - grapheme_strstr = abc == abc
1019: find "bc" in "abc" - grapheme_strstr = bc == bc
1020: find "a" in "abc" - grapheme_strstr before flag is FALSE = abc == abc
1021: find "a" in "abc" - grapheme_strstr before flag is TRUE = ==
1022: find "b" in "abc" - grapheme_strstr before flag is TRUE = a == a
1023: find "c" in "abc" - grapheme_strstr before flag is TRUE = ab == ab
1024: find "bab" in "ababc" - grapheme_strstr before flag is TRUE = a == a
1025: find "abc" in "ababc" - grapheme_strstr before flag is TRUE = ab == ab
1026: find "abc" in "ababc" - grapheme_strstr before flag is FALSE = abc == abc
1027: find "d" in "aba%CC%8Ac" - grapheme_strstr = false == false
1028: find "a" in "bca%CC%8Aa" - grapheme_strstr = a == a
1029: find "b" in "aa%CC%8Abc" - grapheme_strstr = bc == bc
1030: find "a" in "a%CC%8Abc" - grapheme_strstr = false == false
1031: find "ab" in "a%CC%8Aabc" - grapheme_strstr = abc == abc
1032: find "abc" in "abca%CC%8A" - grapheme_strstr = abca%CC%8A == abca%CC%8A
1033: find "a%CC%8Abc" in "aa%CC%8Abc" - grapheme_strstr = a%CC%8Abc == a%CC%8Abc
1034: find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strstr before flag is FALSE = a%CC%8Abc == a%CC%8Abc
1035: find "a" in "aa%CC%8Abc" - grapheme_strstr before flag is TRUE = ==
1036: find "b" in "a%CC%8Aabc" - grapheme_strstr before flag is TRUE = a%CC%8Aa == a%CC%8Aa
1037: find "c" in "aba%CC%8Ac" - grapheme_strstr before flag is TRUE = aba%CC%8A == aba%CC%8A
1038: find "baa%CC%8Ab" in "abaa%CC%8Abc" - grapheme_strstr before flag is TRUE = a == a
1039: find "abca%CC%8A" in "ababca%CC%8A" - grapheme_strstr before flag is TRUE = ab == ab
1040: find "aba%CC%8Ac" in "ababa%CC%8Ac" - grapheme_strstr before flag is FALSE = aba%CC%8Ac == aba%CC%8Ac
1041:
1042: function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}
1043:
1044: find "O%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_stristr = o%CC%88 == o%CC%88
1045: find "o" in "aa%CC%8Abco%CC%88O" - grapheme_stristr = O == O
1046: find "o" in "aa%CC%8Abco%CC%88" - grapheme_stristr = false == false
1047: find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_stristr = a%CC%8Abc == a%CC%8Abc
1048: find "A%CC%8A" in "aa%CC%8Abc" - grapheme_stristr = a%CC%8Abc == a%CC%8Abc
1049: find "a%CC%8A" in "abc" - grapheme_stristr = false == false
1050: find "A" in "a%CC%8Abc" - grapheme_stristr = false == false
1051: find "d" in "abc" - grapheme_stristr = false == false
1052: find "C" in "abc" - grapheme_stristr = c == c
1053: find "b" in "aBc" - grapheme_stristr = Bc == Bc
1054: find "A" in "abc" - grapheme_stristr = abc == abc
1055: find "ab" in "abC" - grapheme_stristr = abC == abC
1056: find "aBc" in "abc" - grapheme_stristr = abc == abc
1057: find "bc" in "abC" - grapheme_stristr = bC == bC
1058: find "A" in "abc" - grapheme_stristr before flag is FALSE = abc == abc
1059: find "a" in "abc" - grapheme_stristr before flag is TRUE = ==
1060: find "b" in "aBc" - grapheme_stristr before flag is TRUE = a == a
1061: find "C" in "abc" - grapheme_stristr before flag is TRUE = ab == ab
1062: find "bab" in "aBabc" - grapheme_stristr before flag is TRUE = a == a
1063: find "aBc" in "ababc" - grapheme_stristr before flag is TRUE = ab == ab
1064: find "abC" in "ababc" - grapheme_stristr before flag is FALSE = abc == abc
1065: find "d" in "aba%CC%8Ac" - grapheme_stristr = false == false
1066: find "a" in "bca%CC%8AA" - grapheme_stristr = A == A
1067: find "B" in "aa%CC%8Abc" - grapheme_stristr = bc == bc
1068: find "a" in "A%CC%8Abc" - grapheme_stristr = false == false
1069: find "Ab" in "a%CC%8Aabc" - grapheme_stristr = abc == abc
1070: find "abc" in "abcA%CC%8A" - grapheme_stristr = abcA%CC%8A == abcA%CC%8A
1071: find "A%CC%8Abc" in "aa%CC%8Abc" - grapheme_stristr = a%CC%8Abc == a%CC%8Abc
1072: find "a%CC%8A" in "aA%CC%8Abc" - grapheme_stristr before flag is FALSE = A%CC%8Abc == A%CC%8Abc
1073: find "A" in "aa%CC%8Abc" - grapheme_stristr before flag is TRUE = ==
1074: find "b" in "a%CC%8AaBc" - grapheme_stristr before flag is TRUE = a%CC%8Aa == a%CC%8Aa
1075: find "C" in "aba%CC%8Ac" - grapheme_stristr before flag is TRUE = aba%CC%8A == aba%CC%8A
1076: find "baa%CC%8Ab" in "abaA%CC%8Abc" - grapheme_stristr before flag is TRUE = a == a
1077: find "aBcA%CC%8A" in "ababca%CC%8A" - grapheme_stristr before flag is TRUE = ab == ab
1078: find "aba%CC%8Ac" in "abABA%CC%8Ac" - grapheme_stristr before flag is FALSE = ABA%CC%8Ac == ABA%CC%8Ac
1079:
1080: function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])
1081:
1082: extract from "abc" "3" graphemes - grapheme_extract = abc == abc
1083: extract from "abc" "2" graphemes - grapheme_extract = ab == ab
1084: extract from "abc" "1" graphemes - grapheme_extract = a == a
1085: extract from "abc" "0" graphemes - grapheme_extract = ==
1086: extract from "abc" "1" graphemes - grapheme_extract starting at byte position 0 = a == a
1087: extract from "abc" "1" graphemes - grapheme_extract starting at byte position 1 = b == b
1088: extract from "abc" "1" graphemes - grapheme_extract starting at byte position 2 = c == c
1089: extract from "abc" "0" graphemes - grapheme_extract starting at byte position 2 = ==
1090: extract from "abc" "3" graphemes - grapheme_extract starting at byte position 0 with $next = abc == abc $next=3 == 3
1091: extract from "abc" "2" graphemes - grapheme_extract starting at byte position 0 with $next = ab == ab $next=2 == 2
1092: extract from "abc" "1" graphemes - grapheme_extract starting at byte position 0 with $next = a == a $next=1 == 1
1093: extract from "abc" "0" graphemes - grapheme_extract starting at byte position 0 with $next = == $next=0 == 0
1094: extract from "abc" "1" graphemes - grapheme_extract starting at byte position 0 with $next = a == a $next=1 == 1
1095: extract from "abc" "1" graphemes - grapheme_extract starting at byte position 1 with $next = b == b $next=2 == 2
1096: extract from "abc" "1" graphemes - grapheme_extract starting at byte position 2 with $next = c == c $next=3 == 3
1097: extract from "abc" "0" graphemes - grapheme_extract starting at byte position 2 with $next = == $next=2 == 2
1098: extract from "http%3A%2F%2Fnews.bbc.co.uk%2F2%2Fhi%2Fmiddle_east%2F7831588.stm" "48" graphemes - grapheme_extract starting at byte position 48 with $next = tm == tm $next=50 == 50
1099: extract from "a%CC%8Abc" "3" graphemes - grapheme_extract = a%CC%8Abc == a%CC%8Abc
1100: extract from "a%CC%8Abc" "2" graphemes - grapheme_extract = a%CC%8Ab == a%CC%8Ab
1101: extract from "a%CC%8Abc" "1" graphemes - grapheme_extract = a%CC%8A == a%CC%8A
1102: extract from "a%CC%8Abc" "3" graphemes - grapheme_extract starting at byte position 0 with $next = a%CC%8Abc == a%CC%8Abc $next=5 == 5
1103: extract from "a%CC%8Abc" "2" graphemes - grapheme_extract starting at byte position 0 with $next = a%CC%8Ab == a%CC%8Ab $next=4 == 4
1104: extract from "a%CC%8Abc" "1" graphemes - grapheme_extract starting at byte position 0 with $next = a%CC%8A == a%CC%8A $next=3 == 3
1105: extract from "a%CC%8Abcde" "2" graphemes - grapheme_extract starting at byte position 3 with $next = bc == bc $next=5 == 5
1106: extract from "a%CC%8Abcde" "2" graphemes - grapheme_extract starting at byte position 4 with $next = cd == cd $next=6 == 6
1107: extract from "a%CC%8Abcdea%CC%8Af" "4" graphemes - grapheme_extract starting at byte position 5 with $next = dea%CC%8Af == dea%CC%8Af $next=11 == 11
1108: extract from "a%CC%8Ao%CC%88o%CC%88" "3" graphemes - grapheme_extract = a%CC%8Ao%CC%88o%CC%88 == a%CC%8Ao%CC%88o%CC%88
1109: extract from "a%CC%8Ao%CC%88o%CC%88" "2" graphemes - grapheme_extract = a%CC%8Ao%CC%88 == a%CC%8Ao%CC%88
1110: extract from "a%CC%8Ao%CC%88c" "1" graphemes - grapheme_extract = a%CC%8A == a%CC%8A
1111: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "1" graphemes - grapheme_extract starting at byte position 0 = o%CC%88 == o%CC%88
1112: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "1" graphemes - grapheme_extract starting at byte position 2 = o%CC%88 == o%CC%88
1113: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "1" graphemes - grapheme_extract starting at byte position 3 = o%CC%88 == o%CC%88
1114: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "1" graphemes - grapheme_extract starting at byte position 4 = %CC%88 == %CC%88
1115: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 0 = o%CC%88o%CC%88 == o%CC%88o%CC%88
1116: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 2 = o%CC%88o%CC%88 == o%CC%88o%CC%88
1117: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 3 = o%CC%88o%CC%88 == o%CC%88o%CC%88
1118: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 4 = %CC%88o%CC%88 == %CC%88o%CC%88
1119: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 7 = %CC%88o%CC%88 == %CC%88o%CC%88
1120: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 8 = o%CC%88 == o%CC%88
1121: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 10 = %CC%88 == %CC%88
1122: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 11 = false == false
1123:
1124: function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)
1125:
1126: extract from "abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = abc == abc
1127: extract from "abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = ab == ab
1128: extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a == a
1129: extract from "abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = ==
1130: extract from "a%CC%8Abc" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Abc == a%CC%8Abc
1131: extract from "a%CC%8Abc" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ab == a%CC%8Ab
1132: extract from "a%CC%8Abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = ==
1133: extract from "a%CC%8Ao%CC%88o%CC%88" "9" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88o%CC%88 == a%CC%8Ao%CC%88o%CC%88
1134: extract from "a%CC%8Ao%CC%88o%CC%88" "10" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88o%CC%88 == a%CC%8Ao%CC%88o%CC%88
1135: extract from "a%CC%8Ao%CC%88o%CC%88" "11" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88o%CC%88 == a%CC%8Ao%CC%88o%CC%88
1136: extract from "a%CC%8Ao%CC%88o%CC%88" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88 == a%CC%8Ao%CC%88
1137: extract from "a%CC%8Ao%CC%88c" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8A == a%CC%8A
1138: extract from "a%CC%8Ao%CC%88c" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8A == a%CC%8A
1139: extract from "a%CC%8Ao%CC%88c" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8A == a%CC%8A
1140: extract from "a%CC%8Ao%CC%88c" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88 == a%CC%8Ao%CC%88
1141: extract from "a%CC%8Ao%CC%88c" "7" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88c == a%CC%8Ao%CC%88c
1142: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 0 = o%CC%88 == o%CC%88
1143: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 2 = o%CC%88 == o%CC%88
1144: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 3 = o%CC%88 == o%CC%88
1145: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 4 = %CC%88 == %CC%88
1146: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 0 = o%CC%88o%CC%88 == o%CC%88o%CC%88
1147: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 2 = o%CC%88o%CC%88 == o%CC%88o%CC%88
1148: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 3 = o%CC%88o%CC%88 == o%CC%88o%CC%88
1149: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 4 = %CC%88o%CC%88 == %CC%88o%CC%88
1150: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 7 = %CC%88o%CC%88 == %CC%88o%CC%88
1151: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 8 = o%CC%88 == o%CC%88
1152: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 10 = %CC%88 == %CC%88
1153: extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES starting at byte position 11 = false == false
1154:
1155: function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)
1156:
1157: extract from "abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abc == abc
1158: extract from "abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ab == ab
1159: extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = a == a
1160: extract from "abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
1161: extract from "abco%CC%88" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
1162: extract from "abco%CC%88" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = a == a
1163: extract from "abco%CC%88" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ab == ab
1164: extract from "abco%CC%88" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abc == abc
1165: extract from "abco%CC%88" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abc == abc
1166: extract from "abco%CC%88" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abco%CC%88 == abco%CC%88
1167: extract from "abco%CC%88" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abco%CC%88 == abco%CC%88
1168: extract from "o%CC%88abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
1169: extract from "o%CC%88abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
1170: extract from "o%CC%88abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88 == o%CC%88
1171: extract from "o%CC%88abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88a == o%CC%88a
1172: extract from "o%CC%88abc" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88ab == o%CC%88ab
1173: extract from "o%CC%88abca%CC%8Axyz" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abc == o%CC%88abc
1174: extract from "o%CC%88abca%CC%8Axyz" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abc == o%CC%88abc
1175: extract from "o%CC%88abca%CC%8Axyz" "7" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abca%CC%8A == o%CC%88abca%CC%8A
1176: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abca%CC%8Ax == o%CC%88abca%CC%8Ax
1177: extract from "abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 0 = abc == abc
1178: extract from "abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 1 = bc == bc
1179: extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 2 = c == c
1180: extract from "abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 3 = false == false
1181: extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 3 = false == false
1182: extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 999 = false == false
1183: extract from "o%CC%88abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 6 = false == false
1184: extract from "o%CC%88abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 999 = false == false
1185: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 0 = o%CC%88abca%CC%8Ax == o%CC%88abca%CC%8Ax
1186: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 1 = %CC%88abca%CC%8Axy == %CC%88abca%CC%8Axy
1187: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 2 = abca%CC%8Axyz == abca%CC%8Axyz
1188: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 3 = abca%CC%8Axyz == abca%CC%8Axyz
1189: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 4 = bca%CC%8Axyz == bca%CC%8Axyz
1190: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 5 = ca%CC%8Axyz == ca%CC%8Axyz
1191: extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 6 = a%CC%8Axyz == a%CC%8Axyz
1192:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>