3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '$£%wow!😮'; echo 'No mb: ' . strlen($string) . PHP_EOL; echo 'With mb: ' . mb_strlen($string) . PHP_EOL; $chrArray = preg_split('//u', $string, -1, PREG_SPLIT_NO_EMPTY); foreach ($chrArray as $chr) { echo $chr . ' ' . strlen($chr) . PHP_EOL; }

preferences:
27.06 ms | 405 KiB | 5 Q