grapheme2.phpt 75 KB

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