Last active
February 20, 2025 22:32
-
-
Save godismyjudge95/3ef849b6558416e098e0251445d5ed5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function sliceAtUTF8Boundary(string $input): string | |
| { | |
| preg_match_all("/\X/u", $input, $matches); | |
| return implode("", array_splice($matches[0], 0, -1)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment