PHP 8.5.0 Alpha 1 available for testing

Voting

: max(three, one)?
(Example: nine)

The Note You're Voting On

jonhoggg at gmail dot com
3 years ago
You can use grapheme_strlen() to count emojis as a single character:

<?php
echo strlen('🏴󠁧󠁢󠁥󠁮󠁧󠁿'); //28 - oh no
echo mb_strlen('🏴󠁧󠁢󠁥󠁮󠁧󠁿'); // - closer, but no
echo grapheme_strlen('🏴󠁧󠁢󠁥󠁮󠁧󠁿'); //1 - Bingo
?>

<< Back to user notes page

To Top