线不会在PHP中断

In the code below I have tried to use the wordwrap function to make a new line every 255 characters. This is to prevent a long text from going off the screen. Could any help me?

 <?php 
$get  = new mysqli('', '', '', '');
$sql = "SELECT * FROM messages ORDER BY id ASC";
$result = $get->query($sql);

    while($r = $result->fetch_assoc()) {
        echo "<div class='chat'><p class='u'>" . $r['username'] . "</p><br /><br /><p class='m'>" . wordwrap($r['message'], 255, '<br />
') . "</p></div><hr /><br /><br /><br />";
    }
?> 

For the to be converted correctly it needed to be in double quotes

wordwrap($r['message'], 20, "<br />
");

try

  $str =$r['message'];
  echo wordwrap($str,15,"<br>
");

The width is not done in characters

Set the fourth parameter of wordwrap() to true in order force a break for words longer than the specified number of characters:

wordwrap($r['message'], 255, "<br />
", true);