array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.grapheme-strstr.php', 1 => 'grapheme_strstr', 2 => 'Returns part of haystack string from the first occurrence of needle to the end of haystack', ), 'up' => array ( 0 => 'ref.intl.grapheme.php', 1 => 'Grapheme Functions', ), 'prev' => array ( 0 => 'function.grapheme-strrpos.php', 1 => 'grapheme_strrpos', ), 'next' => array ( 0 => 'function.grapheme-substr.php', 1 => 'grapheme_substr', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/intl/grapheme/grapheme-strstr.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme_strstr — Returns part of haystack string from the first occurrence of needle to the end of haystack
Procedural style
$haystack,$needle,$beforeNeedle = false,$locale = ""Returns part of haystack string from the first occurrence of needle to the end of haystack (including the needle).
haystackThe input string. Must be valid UTF-8.
needleThe string to look for. Must be valid UTF-8.
beforeNeedle
If true, grapheme_strstr() returns the part of the
haystack before the first occurrence of the needle (excluding the needle).
locale
Returns the portion of haystack, or false if needle is not found.
| Version | Description |
|---|---|
| 8.5.0 |
The optional parameter locale has been added.
|
Example #1 grapheme_strstr() example
<?php
$char_a_ring_nfd = "a\xCC\x8A"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D"
$char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D"
print urlencode(grapheme_stristr( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_a_ring_nfd, $char_o_diaeresis_nfd));
?>The above example will output:
o%CC%88a%CC%8A