(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme_strstr — 返回从 haystack 字符串中 needle 首次出现的位置到 haystack 末尾的部分字符串
过程式风格
返回从 haystack 字符串中 needle 首次出现的位置到 haystack 末尾的部分字符串(包括 needle)。
haystack输入字符串。必须是有效的 UTF-8。
needle要查找的字符串。必须是有效的 UTF-8。
beforeNeedle如果为 true,grapheme_strstr() 返回 haystack 中 needle 首次出现之前的部分(不包括 needle)。
返回 haystack 的一部分,如果找不到 needle 则返回 false。
示例 #1 grapheme_strstr() 例子
<?php
$char_a_ring_nfd = "a\xCC\x8A"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) 规范化形式 "D"
$char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) 规范化形式 "D"
print urlencode(grapheme_stristr( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_a_ring_nfd, $char_o_diaeresis_nfd));
?>以上示例将输出
o%CC%88a%CC%8A