What are the limitations of using wordwrap() in PHP for text formatting?

The limitation of using wordwrap() in PHP for text formatting is that it only breaks lines based on the specified width, which may not take into account the actual content of the text. To address this limitation, you can use the function mb_wordwrap() which considers multi-byte characters, ensuring proper line breaks for languages with non-ASCII characters.

$text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in velit vel nulla ultricies suscipit.";
$formatted_text = mb_wordwrap($text, 30, "\n", true);
echo $formatted_text;