What is the best way to automatically wrap text after a certain character length in PHP?

When working with long strings of text in PHP, it can be helpful to automatically wrap the text after a certain character length to improve readability. One way to achieve this is by using the `wordwrap()` function in PHP. This function allows you to specify the desired character length at which to wrap the text.

$text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
$wrapped_text = wordwrap($text, 30, "\n");

echo $wrapped_text;