array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.grapheme-strstr.php', 1 => 'grapheme_strstr', ), 'up' => array ( 0 => 'ref.intl.grapheme.php', 1 => 'Funções de Grapheme', ), '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' => 'pt_BR', 'path' => 'reference/intl/grapheme/grapheme-strstr.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme_strstr — Retorna parte de uma string a partir da primeira ocorrência de outra string até o final
Estilo procedural
Retorna parte de uma string a partir da primeira ocorrência de outra string (inclusive) até o final.
haystack
A string onde ocorrerá a pesquisa. Deve ser em UTF-8 válido.
needle
A string a ser procurada. Deve ser em UTF-8 válido.
beforeNeedle
Caso seja true
, grapheme_strstr() retorna a parte da string
haystack
antes da primeira ocorrência de needle
(excluindo needle
).
Retorna a parte de haystack
, ou false
se needle
não for encontrada.
Exemplo #1 Exemplo de grapheme_strstr()
<?php
$char_a_ring_nfd = "a\xCC\x8A"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) NFD
$char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) NFD
print urlencode(grapheme_stristr( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_a_ring_nfd, $char_o_diaeresis_nfd));
?>
O exemplo acima produzirá:
o%CC%88a%CC%8A