array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.grapheme-strlen.php', 1 => 'grapheme_strlen', ), 'up' => array ( 0 => 'ref.intl.grapheme.php', 1 => 'Funciones de Grapheme', ), 'prev' => array ( 0 => 'function.grapheme-stristr.php', 1 => 'grapheme_stristr', ), 'next' => array ( 0 => 'function.grapheme-strpos.php', 1 => 'grapheme_strpos', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'es', 'path' => 'reference/intl/grapheme/grapheme-strlen.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_strlen — Obtener la longitud de un string en unidades de grafema
Estilo por procedimientos
Obtiene la longitud de un string en unidades de grafema (no bytes o caracteres)
input
El string al que medir la longitud. Debe ser un string UTF-8 válida.
La longitud del string en caso de éxito, y 0 si el string está vacío.
Ejemplo #1 Ejemplo de grapheme_strlen()
<?php
$carácter_a_anillo_nfd = "a\xCC\x8A"; // 'LETRA MINÚSCULA LATINA A CON ANILLO SUPERIOR' (U+00E5) forma de normalización "D"
$carácter_o_diéresis_nfd = "o\xCC\x88"; // 'LETRA MINÚSCULA LATINA O CON DIÉRESIS' (U+00F6) forma de normalización "D"
print grapheme_strlen( 'abc' . $carácter_a_anillo_nfd . $carácter_o_diéresis_nfd . $carácter_a_anillo_nfd);
?>
El resultado del ejemplo sería:
6