![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP – grapheme_strlen() function
A grapheme is the smallest functional unit of a writing system. Graphemes can be interpreted as the smallest units of writing that correspond with sounds.
The grapheme_strlen() function in PHP is used to get the string length in grapheme units. This function does not get the byte or character's length. The grapheme_strlen function is supported in PHP 5.3.0 and higher versions.
Syntax
integer grapheme_strlen($str_string)
Parameters
grapheme_strlen() accepts only one parameter −
$str_string − The string parameter is used to measure the length of the string and it must use a UTF-8 encoding string.
Return Values
This function returns the length of the string on success or it returns False on failure.
Example
<?php // used the string "abca\xCC\x8Ao\xCC\x88a\xCC\x8A" // to find the length $integer=grapheme_strlen("abca\xCC\x8Ao\xCC\x88a\xCC\x8A\x122"); // output var_dump($integer); ?>
Output
int(8)
Advertisements