I try to remove the last character from a string with Japanese text and emojis using this code:
<?php
$text = "私の名前はダバーです👩🚀";
$new_text = substr($text, 0, strlen($text) - 1);
echo $new_text;
The output breaks the characters and shows garbage. How do I fix this?