Maxim Mironjuk
-
December 07, 2025
Once an application handles names, comments, or bio texts that might contain emoji, accented characters, or non-Latin scripts, the classic PHP functions strlen() and substr() routinely produce wrong results, because they operate byte by byte instead of character by character. Even the improved mb_* functions still fail on complex emoji made up of several combined Unicode code points that visually render as a single character. The Symfony String component solves this with three clearly separated, immutable string classes that make explicit which level you are actually working on, and this article shows exactly when each one is the right choice.