grapheme.phpt 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  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. $arg0 = urlencode($test[0]);
  358. $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr";
  359. if ( 3 == count( $test ) ) {
  360. try {
  361. $result = grapheme_substr($test[0], $test[1]);
  362. } catch (ValueError $exception) {
  363. $res_str .= ": " . $exception->getMessage() . "\n";
  364. }
  365. }
  366. else {
  367. $res_str .= " with length $test[2]";
  368. try {
  369. $result = grapheme_substr($test[0], $test[1], $test[2]);
  370. } catch (ValueError $exception) {
  371. $res_str .= ": " . $exception->getMessage() . "\n";
  372. }
  373. }
  374. $res_str .= " = ";
  375. if ( $result === false ) {
  376. $res_str .= 'false';
  377. }
  378. else {
  379. $res_str .= urlencode($result);
  380. }
  381. $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
  382. }
  383. //=====================================================================================
  384. $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
  385. $tests = array(
  386. array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ),
  387. array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
  388. array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ),
  389. array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
  390. array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
  391. array( "abc", $char_a_ring_nfd, "false" ),
  392. array( $char_a_ring_nfd . "bc", "a", "false" ),
  393. array( "abc", "d", "false" ),
  394. array( "abc", "c", "c" ),
  395. array( "abc", "b", "bc" ),
  396. array( "abc", "a", "abc" ),
  397. array( "abc", "ab", "abc" ),
  398. array( "abc", "abc", "abc" ),
  399. array( "abc", "bc", "bc" ),
  400. array( "abc", "a", FALSE, "abc" ),
  401. array( "abc", "a", TRUE, "" ),
  402. array( "abc", "b", TRUE, "a" ),
  403. array( "abc", "c", TRUE, "ab" ),
  404. array( "ababc", "bab", TRUE, "a" ),
  405. array( "ababc", "abc", TRUE, "ab" ),
  406. array( "ababc", "abc", FALSE, "abc" ),
  407. array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
  408. array( "bc" . $char_a_ring_nfd . "a", "a", "a" ),
  409. array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ),
  410. array( $char_a_ring_nfd . "bc", "a", "false" ),
  411. array( $char_a_ring_nfd . "abc", "ab", "abc" ),
  412. array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd),
  413. array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
  414. array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"),
  415. array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ),
  416. array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ),
  417. array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ),
  418. array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
  419. array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ),
  420. array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ),
  421. );
  422. foreach( $tests as $test ) {
  423. $arg1 = urlencode($test[1]);
  424. $arg0 = urlencode($test[0]);
  425. $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr";
  426. if ( 3 == count( $test ) ) {
  427. try {
  428. $result = grapheme_strstr($test[0], $test[1]);
  429. } catch (ValueError $exception) {
  430. $res_str .= ": " . $exception->getMessage() . "\n";
  431. }
  432. }
  433. else {
  434. $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
  435. try {
  436. $result = grapheme_strstr($test[0], $test[1], $test[2]);
  437. } catch (ValueError $exception) {
  438. $res_str .= ": " . $exception->getMessage() . "\n";
  439. }
  440. }
  441. $res_str .= " = ";
  442. if ( $result === false ) {
  443. $res_str .= 'false';
  444. }
  445. else {
  446. $res_str .= urlencode($result);
  447. }
  448. $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
  449. }
  450. //=====================================================================================
  451. $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
  452. $tests = array(
  453. array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ),
  454. array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ),
  455. array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
  456. array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
  457. array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"),
  458. array( "abc", $char_a_ring_nfd, "false" ),
  459. array( $char_a_ring_nfd . "bc", "A", "false" ),
  460. array( "abc", "d", "false" ),
  461. array( "abc", "C", "c" ),
  462. array( "aBc", "b", "Bc" ),
  463. array( "abc", "A", "abc" ),
  464. array( "abC", "ab", "abC" ),
  465. array( "abc", "aBc", "abc" ),
  466. array( "abC", "bc", "bC" ),
  467. array( "abc", "A", FALSE, "abc" ),
  468. array( "abc", "a", TRUE, "" ),
  469. array( "aBc", "b", TRUE, "a" ),
  470. array( "abc", "C", TRUE, "ab" ),
  471. array( "aBabc", "bab", TRUE, "a" ),
  472. array( "ababc", "aBc", TRUE, "ab" ),
  473. array( "ababc", "abC", FALSE, "abc" ),
  474. array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
  475. array( "bc" . $char_a_ring_nfd . "A", "a", "A" ),
  476. array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ),
  477. array( $char_A_ring_nfd . "bc", "a", "false" ),
  478. array( $char_a_ring_nfd . "abc", "Ab", "abc" ),
  479. array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd),
  480. array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
  481. array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ),
  482. array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ),
  483. array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ),
  484. array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ),
  485. array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
  486. array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ),
  487. array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ),
  488. );
  489. foreach( $tests as $test ) {
  490. $arg1 = urlencode($test[1]);
  491. $arg0 = urlencode($test[0]);
  492. $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr";
  493. if ( 3 == count( $test ) ) {
  494. $result = grapheme_stristr($test[0], $test[1]);
  495. }
  496. else {
  497. $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
  498. $result = grapheme_stristr($test[0], $test[1], $test[2]);
  499. }
  500. $res_str .= " = ";
  501. if ( $result === false ) {
  502. $res_str .= 'false';
  503. }
  504. else {
  505. $res_str .= urlencode($result);
  506. }
  507. $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
  508. }
  509. //=====================================================================================
  510. $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n";
  511. $tests = array(
  512. // haystack, count, [[offset], [next]], result
  513. array( "abc", 3, "abc" ),
  514. array( "abc", 2, "ab" ),
  515. array( "abc", 1, "a" ),
  516. array( "abc", 0, "" ),
  517. array( "abc", 1, 0, "a" ),
  518. array( "abc", 1, 1, "b" ),
  519. array( "abc", 1, 2, "c" ),
  520. array( "abc", 0, 2, "" ),
  521. array( "abc", 3, 0, 3, "abc" ),
  522. array( "abc", 2, 0, 2, "ab" ),
  523. array( "abc", 1, 0, 1, "a" ),
  524. array( "abc", 0, 0, 0, "" ),
  525. array( "abc", 1, 0, 1, "a" ),
  526. array( "abc", 1, 1, 2, "b" ),
  527. array( "abc", 1, 2, 3, "c" ),
  528. array( "abc", 1, -2, 2, "b" ),
  529. array( "abc", 0, 2, 2, "" ),
  530. array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ),
  531. array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ),
  532. array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ),
  533. array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ),
  534. array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ),
  535. array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ),
  536. array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ),
  537. array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ),
  538. array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ),
  539. array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ),
  540. array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ),
  541. array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ),
  542. array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ),
  543. 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 ),
  544. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
  545. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ),
  546. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd),
  547. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd),
  548. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd),
  549. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis),
  550. 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),
  551. 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),
  552. 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),
  553. 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),
  554. 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),
  555. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd),
  556. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
  557. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
  558. );
  559. $next = -1;
  560. foreach( $tests as $test ) {
  561. $arg0 = urlencode($test[0]);
  562. $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract";
  563. if ( 3 == count( $test ) ) {
  564. $result = grapheme_extract($test[0], $test[1]);
  565. }
  566. elseif ( 4 == count ( $test ) ) {
  567. $res_str .= " starting at byte position $test[2]";
  568. $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]);
  569. }
  570. else {
  571. $res_str .= " starting at byte position $test[2] with \$next";
  572. $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next);
  573. }
  574. $res_str .= " = ";
  575. if ( $result === false ) {
  576. $res_str .= 'false';
  577. }
  578. else {
  579. $res_str .= urlencode($result);
  580. }
  581. $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]);
  582. if ( 5 == count ( $test ) ) {
  583. $res_str .= " \$next=$next == $test[3] ";
  584. if ( $next != $test[3] ) {
  585. $res_str .= "***FAILED***";
  586. }
  587. }
  588. $res_str .= "\n";
  589. }
  590. //=====================================================================================
  591. $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n";
  592. $tests = array(
  593. array( "abc", 3, "abc" ),
  594. array( "abc", 2, "ab" ),
  595. array( "abc", 1, "a" ),
  596. array( "abc", 0, "" ),
  597. array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ),
  598. array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ),
  599. array( $char_a_ring_nfd . "bc", 1, "" ),
  600. 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 ),
  601. 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 ),
  602. 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 ),
  603. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
  604. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ),
  605. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ),
  606. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ),
  607. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
  608. array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ),
  609. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd),
  610. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd),
  611. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd),
  612. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis),
  613. 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),
  614. 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),
  615. 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),
  616. 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),
  617. 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),
  618. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd),
  619. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
  620. array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
  621. );
  622. foreach( $tests as $test ) {
  623. $arg0 = urlencode($test[0]);
  624. $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES";
  625. if ( 3 == count( $test ) ) {
  626. $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES);
  627. }
  628. else {
  629. $res_str .= " starting at byte position $test[2]";
  630. $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]);
  631. }
  632. $res_str .= " = ";
  633. if ( $result === false ) {
  634. $res_str .= 'false';
  635. }
  636. else {
  637. $res_str .= urlencode($result);
  638. }
  639. $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
  640. }
  641. //=====================================================================================
  642. $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n";
  643. $tests = array(
  644. array( "abc", 3, "abc" ),
  645. array( "abc", 2, "ab" ),
  646. array( "abc", 1, "a" ),
  647. array( "abc", 0, "" ),
  648. array( "abc" . $char_o_diaeresis_nfd, 0, "" ),
  649. array( "abc" . $char_o_diaeresis_nfd, 1, "a" ),
  650. array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ),
  651. array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ),
  652. array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ),
  653. array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd),
  654. array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd),
  655. array( $char_o_diaeresis_nfd . "abc", 0, "" ),
  656. array( $char_o_diaeresis_nfd . "abc", 1, "" ),
  657. array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ),
  658. array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ),
  659. array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ),
  660. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ),
  661. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ),
  662. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ),
  663. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
  664. array( "abc", 3, 0, "abc" ),
  665. array( "abc", 2, 1, "bc" ),
  666. array( "abc", 1, 2, "c" ),
  667. array( "abc", 0, 3, "false" ),
  668. array( "abc", 1, 3, "false" ),
  669. array( "abc", 1, 999, "false" ),
  670. array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ),
  671. array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ),
  672. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
  673. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ),
  674. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ),
  675. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ),
  676. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ),
  677. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ),
  678. array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ),
  679. );
  680. foreach( $tests as $test ) {
  681. $arg0 = urlencode($test[0]);
  682. $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS";
  683. if ( 3 == count( $test ) ) {
  684. $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS);
  685. }
  686. else {
  687. $res_str .= " starting at byte position $test[2]";
  688. $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]);
  689. }
  690. $res_str .= " = ";
  691. if ( $result === false ) {
  692. $res_str .= 'false';
  693. }
  694. else {
  695. $res_str .= urlencode($result);
  696. }
  697. $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
  698. }
  699. //=====================================================================================
  700. return $res_str;
  701. }
  702. echo ut_main();
  703. function check_result($result, $expected) {
  704. if ( $result === false ) {
  705. $result = 'false';
  706. }
  707. if ( strcmp($result, $expected) != 0 ) {
  708. return " **FAILED** ";
  709. }
  710. return "";
  711. }
  712. ?>
  713. --EXPECT--
  714. function grapheme_strlen($string) {}
  715. "hindi" in devanagari strlen 3
  716. "ab" + "hindi" + "cde" strlen 8
  717. "" strlen 0
  718. char_a_ring_nfd strlen 1
  719. char_a_ring_nfd + "bc" strlen 3
  720. "abc" strlen 3
  721. function grapheme_strpos($haystack, $needle, $offset = 0) {}
  722. find "o" in "aa%CC%8Abco%CC%88o" - grapheme_strpos = 5 == 5
  723. find "o" in "aa%CC%8Abco%CC%88" - grapheme_strpos = false == false
  724. find "o%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_strpos = 4 == 4
  725. find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strpos = 2 == 2
  726. find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strpos = 1 == 1
  727. find "a%CC%8A" in "abc" - grapheme_strpos = false == false
  728. find "a" in "a%CC%8Abc" - grapheme_strpos = false == false
  729. find "d" in "abc" - grapheme_strpos = false == false
  730. find "c" in "abc" - grapheme_strpos = 2 == 2
  731. find "b" in "abc" - grapheme_strpos = 1 == 1
  732. find "a" in "abc" - grapheme_strpos = 0 == 0
  733. find "a" in "abc" - grapheme_strpos from 0 = 0 == 0
  734. find "a" in "abc" - grapheme_strpos from 1 = false == false
  735. find "a" in "abc" - grapheme_strpos from -1 = false == false
  736. find "a" in "ababc" - grapheme_strpos from 1 = 2 == 2
  737. find "o" in "aoa%CC%8Abco%CC%88o" - grapheme_strpos from 2 = 6 == 6
  738. find "o" in "aoa%CC%8Abco%CC%88o" - grapheme_strpos from -1 = 6 == 6
  739. find "o" in "aoa%CC%8Abco%CC%88o" - grapheme_strpos from -5 = 6 == 6
  740. find "a%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abc" - grapheme_strpos from 2 = 3 == 3
  741. find "a%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abc" - grapheme_strpos from -4 = 3 == 3
  742. find "op" in "aa%CC%8Abco%CC%88opq" - grapheme_strpos = 5 == 5
  743. find "opq" in "aa%CC%8Abco%CC%88opq" - grapheme_strpos = 5 == 5
  744. find "abc" in "aa%CC%8Abco%CC%88" - grapheme_strpos = false == false
  745. find "o%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bco%CC%88" - grapheme_strpos = 4 == 4
  746. find "a%CC%8Abc" in "o%CC%88aa%CC%8Abc" - grapheme_strpos = 2 == 2
  747. find "a%CC%8Abc" in "aa%CC%8Abc" - grapheme_strpos = 1 == 1
  748. find "a%CC%8Abc" in "abc" - grapheme_strpos = false == false
  749. find "abcdefg" in "a%CC%8Abc" - grapheme_strpos = false == false
  750. find "defghijklmnopq" in "abc" - grapheme_strpos = false == false
  751. find "ab" in "abc" - grapheme_strpos = 0 == 0
  752. find "bc" in "abc" - grapheme_strpos = 1 == 1
  753. find "abc" in "abc" - grapheme_strpos = 0 == 0
  754. find "abcd" in "abc" - grapheme_strpos = false == false
  755. find "ab" in "abc" - grapheme_strpos from 0 = 0 == 0
  756. find "abc" in "abc" - grapheme_strpos from 0 = 0 == 0
  757. find "abc" in "abc" - grapheme_strpos from 1 = false == false
  758. find "ab" in "ababc" - grapheme_strpos from 1 = 2 == 2
  759. find "abc" in "ababc" - grapheme_strpos from 1 = 2 == 2
  760. find "oa%CC%8Abc" in "aoa%CC%8Abco%CC%88oa%CC%8Abc" - grapheme_strpos from 2 = 6 == 6
  761. find "oa%CC%8Abc" in "aoa%CC%8Abco%CC%88oa%CC%8Abc" - grapheme_strpos from -8 = 6 == 6
  762. find "a%CC%8Abca%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abca%CC%8Adef" - grapheme_strpos from 2 = 3 == 3
  763. function grapheme_stripos($haystack, $needle, $offset = 0) {}
  764. find "o" in "aoa%CC%8Abco%CC%88O" - grapheme_stripos from 2 = 6 == 6
  765. find "o" in "aoa%CC%8Abco%CC%88Oo" - grapheme_stripos from -6 = 6 == 6
  766. find "a%CC%8A" in "o%CC%88a%CC%8AaA%CC%8Abc" - grapheme_stripos from 2 = 3 == 3
  767. find "o" in "aa%CC%8Abco%CC%88O" - grapheme_stripos = 5 == 5
  768. find "O" in "aa%CC%8Abco%CC%88" - grapheme_stripos = false == false
  769. find "o%CC%88" in "aa%CC%8AbcO%CC%88" - grapheme_stripos = 4 == 4
  770. find "o%CC%88" in "aa%CC%8AbcO%CC%88" - grapheme_stripos from -1 = 4 == 4
  771. find "A%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_stripos = 2 == 2
  772. find "a%CC%8A" in "aA%CC%8Abc" - grapheme_stripos = 1 == 1
  773. find "a%CC%8A" in "Abc" - grapheme_stripos = false == false
  774. find "A" in "a%CC%8Abc" - grapheme_stripos = false == false
  775. find "D" in "abc" - grapheme_stripos = false == false
  776. find "c" in "abC" - grapheme_stripos = 2 == 2
  777. find "B" in "abc" - grapheme_stripos = 1 == 1
  778. find "a" in "Abc" - grapheme_stripos = 0 == 0
  779. find "A" in "abc" - grapheme_stripos from 0 = 0 == 0
  780. find "a" in "Abc" - grapheme_stripos from 1 = false == false
  781. find "A" in "ababc" - grapheme_stripos from 1 = 2 == 2
  782. find "oP" in "aa%CC%8Abco%CC%88Opq" - grapheme_stripos = 5 == 5
  783. find "opQ" in "aa%CC%8Abco%CC%88Opq" - grapheme_stripos = 5 == 5
  784. find "abc" in "aa%CC%8Abco%CC%88" - grapheme_stripos = false == false
  785. find "O%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bCo%CC%88" - grapheme_stripos = 4 == 4
  786. find "A%CC%8Abc" in "o%CC%88aa%CC%8ABc" - grapheme_stripos = 2 == 2
  787. find "a%CC%8Abc" in "aa%CC%8ABC" - grapheme_stripos = 1 == 1
  788. find "a%CC%8ABC" in "abc" - grapheme_stripos = false == false
  789. find "aBCdefg" in "a%CC%8ABC" - grapheme_stripos = false == false
  790. find "Defghijklmnopq" in "aBC" - grapheme_stripos = false == false
  791. find "Ab" in "abC" - grapheme_stripos = 0 == 0
  792. find "bc" in "aBC" - grapheme_stripos = 1 == 1
  793. find "Abc" in "abC" - grapheme_stripos = 0 == 0
  794. find "aBcd" in "abC" - grapheme_stripos = false == false
  795. find "ab" in "ABc" - grapheme_stripos from 0 = 0 == 0
  796. find "abC" in "aBc" - grapheme_stripos from 0 = 0 == 0
  797. find "aBc" in "abc" - grapheme_stripos from 1 = false == false
  798. find "AB" in "ABabc" - grapheme_stripos from 1 = 2 == 2
  799. find "AB" in "ABabc" - grapheme_stripos from -4 = 2 == 2
  800. find "aBc" in "abaBc" - grapheme_stripos from 1 = 2 == 2
  801. find "Oa%CC%8AbC" in "aoa%CC%8Abco%CC%88oA%CC%8AbC" - grapheme_stripos from 2 = 6 == 6
  802. find "a%CC%8ABca%CC%8A" in "o%CC%88a%CC%8AaA%CC%8AbCa%CC%8Adef" - grapheme_stripos from 2 = 3 == 3
  803. function grapheme_strrpos($haystack, $needle, $offset = 0) {}
  804. find "o" in "aa%CC%8Abco%CC%88o" - grapheme_strrpos = 5 == 5
  805. find "o" in "aa%CC%8Abco%CC%88" - grapheme_strrpos = false == false
  806. find "o%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_strrpos = 4 == 4
  807. find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strrpos = 2 == 2
  808. find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strrpos = 1 == 1
  809. find "a%CC%8A" in "abc" - grapheme_strrpos = false == false
  810. find "a" in "a%CC%8Abc" - grapheme_strrpos = false == false
  811. find "d" in "abc" - grapheme_strrpos = false == false
  812. find "c" in "abc" - grapheme_strrpos = 2 == 2
  813. find "b" in "abc" - grapheme_strrpos = 1 == 1
  814. find "a" in "abc" - grapheme_strrpos = 0 == 0
  815. find "a" in "abc" - grapheme_strrpos from 0 = 0 == 0
  816. find "a" in "abc" - grapheme_strrpos from 1 = false == false
  817. find "a" in "ababc" - grapheme_strrpos from 1 = 2 == 2
  818. find "o" in "aoa%CC%8Abco%CC%88o" - grapheme_strrpos from 2 = 6 == 6
  819. find "a%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abc" - grapheme_strrpos from 2 = 3 == 3
  820. find "op" in "aa%CC%8Abco%CC%88opq" - grapheme_strrpos = 5 == 5
  821. find "opq" in "aa%CC%8Abco%CC%88opq" - grapheme_strrpos = 5 == 5
  822. find "abc" in "aa%CC%8Abco%CC%88" - grapheme_strrpos = false == false
  823. find "o%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bco%CC%88" - grapheme_strrpos = 4 == 4
  824. find "a%CC%8Abc" in "o%CC%88aa%CC%8Abc" - grapheme_strrpos = 2 == 2
  825. find "a%CC%8Abc" in "aa%CC%8Abc" - grapheme_strrpos = 1 == 1
  826. find "a%CC%8Abc" in "abc" - grapheme_strrpos = false == false
  827. find "abcdefg" in "a%CC%8Abc" - grapheme_strrpos = false == false
  828. find "defghijklmnopq" in "abc" - grapheme_strrpos = false == false
  829. find "ab" in "abc" - grapheme_strrpos = 0 == 0
  830. find "bc" in "abc" - grapheme_strrpos = 1 == 1
  831. find "abc" in "abc" - grapheme_strrpos = 0 == 0
  832. find "abcd" in "abc" - grapheme_strrpos = false == false
  833. find "ab" in "abc" - grapheme_strrpos from 0 = 0 == 0
  834. find "abc" in "abc" - grapheme_strrpos from 0 = 0 == 0
  835. find "abc" in "abc" - grapheme_strrpos from 1 = false == false
  836. find "ab" in "ababc" - grapheme_strrpos from 1 = 2 == 2
  837. find "abc" in "ababc" - grapheme_strrpos from 1 = 2 == 2
  838. find "oa%CC%8Abc" in "aoa%CC%8Abco%CC%88oa%CC%8Abc" - grapheme_strrpos from 2 = 6 == 6
  839. find "a%CC%8Abca%CC%8A" in "o%CC%88a%CC%8Aaa%CC%8Abca%CC%8Adef" - grapheme_strrpos from 2 = 3 == 3
  840. function grapheme_strripos($haystack, $needle, $offset = 0) {}
  841. find "o" in "aoa%CC%8Abco%CC%88O" - grapheme_strripos from 2 = 6 == 6
  842. find "a%CC%8A" in "o%CC%88a%CC%8AaA%CC%8Abc" - grapheme_strripos from 2 = 3 == 3
  843. find "o" in "aa%CC%8Abco%CC%88O" - grapheme_strripos = 5 == 5
  844. find "O" in "aa%CC%8Abco%CC%88" - grapheme_strripos = false == false
  845. find "o%CC%88" in "aa%CC%8AbcO%CC%88" - grapheme_strripos = 4 == 4
  846. find "A%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strripos = 2 == 2
  847. find "a%CC%8A" in "aA%CC%8Abc" - grapheme_strripos = 1 == 1
  848. find "a%CC%8A" in "Abc" - grapheme_strripos = false == false
  849. find "A" in "a%CC%8Abc" - grapheme_strripos = false == false
  850. find "D" in "abc" - grapheme_strripos = false == false
  851. find "c" in "abC" - grapheme_strripos = 2 == 2
  852. find "B" in "abc" - grapheme_strripos = 1 == 1
  853. find "a" in "Abc" - grapheme_strripos = 0 == 0
  854. find "A" in "abc" - grapheme_strripos from 0 = 0 == 0
  855. find "a" in "Abc" - grapheme_strripos from 1 = false == false
  856. find "A" in "ababc" - grapheme_strripos from 1 = 2 == 2
  857. find "oP" in "aa%CC%8Abco%CC%88Opq" - grapheme_strripos = 5 == 5
  858. find "opQ" in "aa%CC%8Abco%CC%88Opq" - grapheme_strripos = 5 == 5
  859. find "abc" in "aa%CC%8Abco%CC%88" - grapheme_strripos = false == false
  860. find "O%CC%88bco%CC%88" in "aa%CC%8Abco%CC%88bCo%CC%88" - grapheme_strripos = 4 == 4
  861. find "A%CC%8Abc" in "o%CC%88aa%CC%8ABc" - grapheme_strripos = 2 == 2
  862. find "a%CC%8Abc" in "aa%CC%8ABC" - grapheme_strripos = 1 == 1
  863. find "a%CC%8ABC" in "abc" - grapheme_strripos = false == false
  864. find "aBCdefg" in "a%CC%8ABC" - grapheme_strripos = false == false
  865. find "Defghijklmnopq" in "aBC" - grapheme_strripos = false == false
  866. find "Ab" in "abC" - grapheme_strripos = 0 == 0
  867. find "bc" in "aBC" - grapheme_strripos = 1 == 1
  868. find "Abc" in "abC" - grapheme_strripos = 0 == 0
  869. find "aBcd" in "abC" - grapheme_strripos = false == false
  870. find "ab" in "ABc" - grapheme_strripos from 0 = 0 == 0
  871. find "abC" in "aBc" - grapheme_strripos from 0 = 0 == 0
  872. find "aBc" in "abc" - grapheme_strripos from 1 = false == false
  873. find "AB" in "ABabc" - grapheme_strripos from 1 = 2 == 2
  874. find "aBc" in "abaBc" - grapheme_strripos from 1 = 2 == 2
  875. find "Oa%CC%8AbC" in "aoa%CC%8Abco%CC%88oA%CC%8AbC" - grapheme_strripos from 2 = 6 == 6
  876. find "a%CC%8ABca%CC%8A" in "o%CC%88a%CC%8AaA%CC%8AbCa%CC%8Adef" - grapheme_strripos from 2 = 3 == 3
  877. function grapheme_substr($string, $start, $length = -1) {}
  878. substring of "abc" from "3" - grapheme_substr = ==
  879. substring of "aa%CC%8Abco%CC%88" from "5" - grapheme_substr = ==
  880. substring of "aoa%CC%8Abco%CC%88O" from "2" - grapheme_substr = a%CC%8Abco%CC%88O == a%CC%8Abco%CC%88O
  881. substring of "o%CC%88a%CC%8AaA%CC%8Abc" from "2" - grapheme_substr = aA%CC%8Abc == aA%CC%8Abc
  882. substring of "aa%CC%8Abco%CC%88O" from "5" - grapheme_substr = O == O
  883. substring of "aa%CC%8Abco%CC%88" from "5" - grapheme_substr = ==
  884. substring of "aa%CC%8AbcO%CC%88" from "4" - grapheme_substr = O%CC%88 == O%CC%88
  885. substring of "o%CC%88aa%CC%8Abc" from "2" - grapheme_substr = a%CC%8Abc == a%CC%8Abc
  886. substring of "aA%CC%8Abc" from "1" - grapheme_substr = A%CC%8Abc == A%CC%8Abc
  887. substring of "Abc" from "-5" - grapheme_substr = Abc == Abc
  888. substring of "a%CC%8Abc" from "3" - grapheme_substr = ==
  889. substring of "abc" from "4" - grapheme_substr = ==
  890. substring of "abC" from "2" - grapheme_substr = C == C
  891. substring of "abc" from "1" - grapheme_substr = bc == bc
  892. substring of "Abc" from "1" - grapheme_substr with length 1 = b == b
  893. substring of "abc" from "0" - grapheme_substr with length 2 = ab == ab
  894. substring of "Abc" from "-4" - grapheme_substr with length 1 = A == A
  895. substring of "ababc" from "1" - grapheme_substr with length 2 = ba == ba
  896. substring of "ababc" from "0" - grapheme_substr with length 10 = ababc == ababc
  897. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length 10 = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
  898. substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr = Opq == Opq
  899. substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -1 = Op == Op
  900. substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -2 = O == O
  901. substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -3 = ==
  902. substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -4 = ==
  903. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
  904. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -1 = aa%CC%8Abco%CC%88Op == aa%CC%8Abco%CC%88Op
  905. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -2 = aa%CC%8Abco%CC%88O == aa%CC%8Abco%CC%88O
  906. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -3 = aa%CC%8Abco%CC%88 == aa%CC%8Abco%CC%88
  907. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -4 = aa%CC%8Abc == aa%CC%8Abc
  908. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -5 = aa%CC%8Ab == aa%CC%8Ab
  909. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -6 = aa%CC%8A == aa%CC%8A
  910. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -7 = a == a
  911. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -8 = ==
  912. substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length -9 = ==
  913. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
  914. substring of "aa%CC%8Abco%CC%88Opq" from "-7" - grapheme_substr = a%CC%8Abco%CC%88Opq == a%CC%8Abco%CC%88Opq
  915. substring of "aa%CC%8Abco%CC%88Opq" from "-6" - grapheme_substr = bco%CC%88Opq == bco%CC%88Opq
  916. substring of "aa%CC%8Abco%CC%88Opq" from "-5" - grapheme_substr = co%CC%88Opq == co%CC%88Opq
  917. substring of "aa%CC%8Abco%CC%88Opq" from "-4" - grapheme_substr = o%CC%88Opq == o%CC%88Opq
  918. substring of "aa%CC%8Abco%CC%88Opq" from "-3" - grapheme_substr = Opq == Opq
  919. substring of "aa%CC%8Abco%CC%88Opq" from "-2" - grapheme_substr = pq == pq
  920. substring of "aa%CC%8Abco%CC%88Opq" from "-1" - grapheme_substr = q == q
  921. substring of "aa%CC%8Abco%CC%88Opq" from "-999" - grapheme_substr = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
  922. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 8 = aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
  923. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 7 = aa%CC%8Abco%CC%88Op == aa%CC%8Abco%CC%88Op
  924. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 6 = aa%CC%8Abco%CC%88O == aa%CC%8Abco%CC%88O
  925. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 5 = aa%CC%8Abco%CC%88 == aa%CC%8Abco%CC%88
  926. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 4 = aa%CC%8Abc == aa%CC%8Abc
  927. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 3 = aa%CC%8Ab == aa%CC%8Ab
  928. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 2 = aa%CC%8A == aa%CC%8A
  929. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 1 = a == a
  930. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length 0 = ==
  931. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -999 = ==
  932. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -1 = aa%CC%8Abco%CC%88Op == aa%CC%8Abco%CC%88Op
  933. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -2 = aa%CC%8Abco%CC%88O == aa%CC%8Abco%CC%88O
  934. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -3 = aa%CC%8Abco%CC%88 == aa%CC%8Abco%CC%88
  935. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -4 = aa%CC%8Abc == aa%CC%8Abc
  936. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -5 = aa%CC%8Ab == aa%CC%8Ab
  937. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -6 = aa%CC%8A == aa%CC%8A
  938. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -7 = a == a
  939. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -8 = ==
  940. substring of "aa%CC%8Abco%CC%88Opq" from "-8" - grapheme_substr with length -9 = ==
  941. function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}
  942. find "o" in "aa%CC%8Abco%CC%88o" - grapheme_strstr = o == o
  943. find "o" in "aa%CC%8Abco%CC%88" - grapheme_strstr = false == false
  944. find "o%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_strstr = o%CC%88 == o%CC%88
  945. find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_strstr = a%CC%8Abc == a%CC%8Abc
  946. find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strstr = a%CC%8Abc == a%CC%8Abc
  947. find "a%CC%8A" in "abc" - grapheme_strstr = false == false
  948. find "a" in "a%CC%8Abc" - grapheme_strstr = false == false
  949. find "d" in "abc" - grapheme_strstr = false == false
  950. find "c" in "abc" - grapheme_strstr = c == c
  951. find "b" in "abc" - grapheme_strstr = bc == bc
  952. find "a" in "abc" - grapheme_strstr = abc == abc
  953. find "ab" in "abc" - grapheme_strstr = abc == abc
  954. find "abc" in "abc" - grapheme_strstr = abc == abc
  955. find "bc" in "abc" - grapheme_strstr = bc == bc
  956. find "a" in "abc" - grapheme_strstr before flag is FALSE = abc == abc
  957. find "a" in "abc" - grapheme_strstr before flag is TRUE = ==
  958. find "b" in "abc" - grapheme_strstr before flag is TRUE = a == a
  959. find "c" in "abc" - grapheme_strstr before flag is TRUE = ab == ab
  960. find "bab" in "ababc" - grapheme_strstr before flag is TRUE = a == a
  961. find "abc" in "ababc" - grapheme_strstr before flag is TRUE = ab == ab
  962. find "abc" in "ababc" - grapheme_strstr before flag is FALSE = abc == abc
  963. find "d" in "aba%CC%8Ac" - grapheme_strstr = false == false
  964. find "a" in "bca%CC%8Aa" - grapheme_strstr = a == a
  965. find "b" in "aa%CC%8Abc" - grapheme_strstr = bc == bc
  966. find "a" in "a%CC%8Abc" - grapheme_strstr = false == false
  967. find "ab" in "a%CC%8Aabc" - grapheme_strstr = abc == abc
  968. find "abc" in "abca%CC%8A" - grapheme_strstr = abca%CC%8A == abca%CC%8A
  969. find "a%CC%8Abc" in "aa%CC%8Abc" - grapheme_strstr = a%CC%8Abc == a%CC%8Abc
  970. find "a%CC%8A" in "aa%CC%8Abc" - grapheme_strstr before flag is FALSE = a%CC%8Abc == a%CC%8Abc
  971. find "a" in "aa%CC%8Abc" - grapheme_strstr before flag is TRUE = ==
  972. find "b" in "a%CC%8Aabc" - grapheme_strstr before flag is TRUE = a%CC%8Aa == a%CC%8Aa
  973. find "c" in "aba%CC%8Ac" - grapheme_strstr before flag is TRUE = aba%CC%8A == aba%CC%8A
  974. find "baa%CC%8Ab" in "abaa%CC%8Abc" - grapheme_strstr before flag is TRUE = a == a
  975. find "abca%CC%8A" in "ababca%CC%8A" - grapheme_strstr before flag is TRUE = ab == ab
  976. find "aba%CC%8Ac" in "ababa%CC%8Ac" - grapheme_strstr before flag is FALSE = aba%CC%8Ac == aba%CC%8Ac
  977. function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}
  978. find "O%CC%88" in "aa%CC%8Abco%CC%88" - grapheme_stristr = o%CC%88 == o%CC%88
  979. find "o" in "aa%CC%8Abco%CC%88O" - grapheme_stristr = O == O
  980. find "o" in "aa%CC%8Abco%CC%88" - grapheme_stristr = false == false
  981. find "a%CC%8A" in "o%CC%88aa%CC%8Abc" - grapheme_stristr = a%CC%8Abc == a%CC%8Abc
  982. find "A%CC%8A" in "aa%CC%8Abc" - grapheme_stristr = a%CC%8Abc == a%CC%8Abc
  983. find "a%CC%8A" in "abc" - grapheme_stristr = false == false
  984. find "A" in "a%CC%8Abc" - grapheme_stristr = false == false
  985. find "d" in "abc" - grapheme_stristr = false == false
  986. find "C" in "abc" - grapheme_stristr = c == c
  987. find "b" in "aBc" - grapheme_stristr = Bc == Bc
  988. find "A" in "abc" - grapheme_stristr = abc == abc
  989. find "ab" in "abC" - grapheme_stristr = abC == abC
  990. find "aBc" in "abc" - grapheme_stristr = abc == abc
  991. find "bc" in "abC" - grapheme_stristr = bC == bC
  992. find "A" in "abc" - grapheme_stristr before flag is FALSE = abc == abc
  993. find "a" in "abc" - grapheme_stristr before flag is TRUE = ==
  994. find "b" in "aBc" - grapheme_stristr before flag is TRUE = a == a
  995. find "C" in "abc" - grapheme_stristr before flag is TRUE = ab == ab
  996. find "bab" in "aBabc" - grapheme_stristr before flag is TRUE = a == a
  997. find "aBc" in "ababc" - grapheme_stristr before flag is TRUE = ab == ab
  998. find "abC" in "ababc" - grapheme_stristr before flag is FALSE = abc == abc
  999. find "d" in "aba%CC%8Ac" - grapheme_stristr = false == false
  1000. find "a" in "bca%CC%8AA" - grapheme_stristr = A == A
  1001. find "B" in "aa%CC%8Abc" - grapheme_stristr = bc == bc
  1002. find "a" in "A%CC%8Abc" - grapheme_stristr = false == false
  1003. find "Ab" in "a%CC%8Aabc" - grapheme_stristr = abc == abc
  1004. find "abc" in "abcA%CC%8A" - grapheme_stristr = abcA%CC%8A == abcA%CC%8A
  1005. find "A%CC%8Abc" in "aa%CC%8Abc" - grapheme_stristr = a%CC%8Abc == a%CC%8Abc
  1006. find "a%CC%8A" in "aA%CC%8Abc" - grapheme_stristr before flag is FALSE = A%CC%8Abc == A%CC%8Abc
  1007. find "A" in "aa%CC%8Abc" - grapheme_stristr before flag is TRUE = ==
  1008. find "b" in "a%CC%8AaBc" - grapheme_stristr before flag is TRUE = a%CC%8Aa == a%CC%8Aa
  1009. find "C" in "aba%CC%8Ac" - grapheme_stristr before flag is TRUE = aba%CC%8A == aba%CC%8A
  1010. find "baa%CC%8Ab" in "abaA%CC%8Abc" - grapheme_stristr before flag is TRUE = a == a
  1011. find "aBcA%CC%8A" in "ababca%CC%8A" - grapheme_stristr before flag is TRUE = ab == ab
  1012. find "aba%CC%8Ac" in "abABA%CC%8Ac" - grapheme_stristr before flag is FALSE = ABA%CC%8Ac == ABA%CC%8Ac
  1013. function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])
  1014. extract from "abc" "3" graphemes - grapheme_extract = abc == abc
  1015. extract from "abc" "2" graphemes - grapheme_extract = ab == ab
  1016. extract from "abc" "1" graphemes - grapheme_extract = a == a
  1017. extract from "abc" "0" graphemes - grapheme_extract = ==
  1018. extract from "abc" "1" graphemes - grapheme_extract starting at byte position 0 = a == a
  1019. extract from "abc" "1" graphemes - grapheme_extract starting at byte position 1 = b == b
  1020. extract from "abc" "1" graphemes - grapheme_extract starting at byte position 2 = c == c
  1021. extract from "abc" "0" graphemes - grapheme_extract starting at byte position 2 = ==
  1022. extract from "abc" "3" graphemes - grapheme_extract starting at byte position 0 with $next = abc == abc $next=3 == 3
  1023. extract from "abc" "2" graphemes - grapheme_extract starting at byte position 0 with $next = ab == ab $next=2 == 2
  1024. extract from "abc" "1" graphemes - grapheme_extract starting at byte position 0 with $next = a == a $next=1 == 1
  1025. extract from "abc" "0" graphemes - grapheme_extract starting at byte position 0 with $next = == $next=0 == 0
  1026. extract from "abc" "1" graphemes - grapheme_extract starting at byte position 0 with $next = a == a $next=1 == 1
  1027. extract from "abc" "1" graphemes - grapheme_extract starting at byte position 1 with $next = b == b $next=2 == 2
  1028. extract from "abc" "1" graphemes - grapheme_extract starting at byte position 2 with $next = c == c $next=3 == 3
  1029. extract from "abc" "1" graphemes - grapheme_extract starting at byte position -2 with $next = b == b $next=2 == 2
  1030. extract from "abc" "0" graphemes - grapheme_extract starting at byte position 2 with $next = == $next=2 == 2
  1031. 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
  1032. extract from "a%CC%8Abc" "3" graphemes - grapheme_extract = a%CC%8Abc == a%CC%8Abc
  1033. extract from "a%CC%8Abc" "2" graphemes - grapheme_extract = a%CC%8Ab == a%CC%8Ab
  1034. extract from "a%CC%8Abc" "1" graphemes - grapheme_extract = a%CC%8A == a%CC%8A
  1035. 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
  1036. 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
  1037. 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
  1038. extract from "a%CC%8Abcde" "2" graphemes - grapheme_extract starting at byte position 3 with $next = bc == bc $next=5 == 5
  1039. extract from "a%CC%8Abcde" "2" graphemes - grapheme_extract starting at byte position -4 with $next = bc == bc $next=5 == 5
  1040. extract from "a%CC%8Abcde" "2" graphemes - grapheme_extract starting at byte position 4 with $next = cd == cd $next=6 == 6
  1041. 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
  1042. 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
  1043. 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
  1044. 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
  1045. extract from "a%CC%8Ao%CC%88o%CC%88" "2" graphemes - grapheme_extract = a%CC%8Ao%CC%88 == a%CC%8Ao%CC%88
  1046. extract from "a%CC%8Ao%CC%88c" "1" graphemes - grapheme_extract = a%CC%8A == a%CC%8A
  1047. 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
  1048. 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
  1049. 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
  1050. extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "1" graphemes - grapheme_extract starting at byte position 4 = %CC%88 == %CC%88
  1051. 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
  1052. 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
  1053. 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
  1054. 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
  1055. 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
  1056. 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
  1057. extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 10 = %CC%88 == %CC%88
  1058. extract from "o%CC%88o%CC%88o%CC%88o%CC%88" "2" graphemes - grapheme_extract starting at byte position 11 = false == false
  1059. function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)
  1060. extract from "abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = abc == abc
  1061. extract from "abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = ab == ab
  1062. extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a == a
  1063. extract from "abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = ==
  1064. extract from "a%CC%8Abc" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Abc == a%CC%8Abc
  1065. extract from "a%CC%8Abc" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ab == a%CC%8Ab
  1066. extract from "a%CC%8Abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = ==
  1067. 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
  1068. 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
  1069. 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
  1070. 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
  1071. extract from "a%CC%8Ao%CC%88c" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8A == a%CC%8A
  1072. extract from "a%CC%8Ao%CC%88c" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8A == a%CC%8A
  1073. extract from "a%CC%8Ao%CC%88c" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8A == a%CC%8A
  1074. extract from "a%CC%8Ao%CC%88c" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88 == a%CC%8Ao%CC%88
  1075. extract from "a%CC%8Ao%CC%88c" "7" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES = a%CC%8Ao%CC%88c == a%CC%8Ao%CC%88c
  1076. 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
  1077. 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
  1078. 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
  1079. 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
  1080. 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
  1081. 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
  1082. 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
  1083. 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
  1084. 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
  1085. 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
  1086. 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
  1087. 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
  1088. function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)
  1089. extract from "abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abc == abc
  1090. extract from "abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ab == ab
  1091. extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = a == a
  1092. extract from "abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
  1093. extract from "abco%CC%88" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
  1094. extract from "abco%CC%88" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = a == a
  1095. extract from "abco%CC%88" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ab == ab
  1096. extract from "abco%CC%88" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abc == abc
  1097. extract from "abco%CC%88" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abc == abc
  1098. extract from "abco%CC%88" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abco%CC%88 == abco%CC%88
  1099. extract from "abco%CC%88" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = abco%CC%88 == abco%CC%88
  1100. extract from "o%CC%88abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
  1101. extract from "o%CC%88abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = ==
  1102. extract from "o%CC%88abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88 == o%CC%88
  1103. extract from "o%CC%88abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88a == o%CC%88a
  1104. extract from "o%CC%88abc" "4" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88ab == o%CC%88ab
  1105. extract from "o%CC%88abca%CC%8Axyz" "5" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abc == o%CC%88abc
  1106. extract from "o%CC%88abca%CC%8Axyz" "6" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abc == o%CC%88abc
  1107. extract from "o%CC%88abca%CC%8Axyz" "7" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abca%CC%8A == o%CC%88abca%CC%8A
  1108. extract from "o%CC%88abca%CC%8Axyz" "8" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS = o%CC%88abca%CC%8Ax == o%CC%88abca%CC%8Ax
  1109. extract from "abc" "3" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 0 = abc == abc
  1110. extract from "abc" "2" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 1 = bc == bc
  1111. extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 2 = c == c
  1112. extract from "abc" "0" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 3 = false == false
  1113. extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 3 = false == false
  1114. extract from "abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 999 = false == false
  1115. extract from "o%CC%88abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 6 = false == false
  1116. extract from "o%CC%88abc" "1" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS starting at byte position 999 = false == false
  1117. 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
  1118. 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
  1119. 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
  1120. 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
  1121. 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
  1122. 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
  1123. 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