What is the best way to implement a line break for a string in PHP after a certain length?

When working with strings in PHP, it is common to encounter the need to insert line breaks after a certain length to improve readability or formatting. One way to achieve this is by using the `wordwrap()` function in PHP, which breaks a string into a specified number of characters per line. By setting the second parameter of `wordwrap()` to the desired line length and using the third parameter to specify the line break character, you can easily implement line breaks in your string.

$string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
$wrapped_string = wordwrap($string, 30, "<br>");

echo $wrapped_string;