Jump to content

Archived

This topic is now archived and is closed to further replies.

crzyman

Help with using trim *SOLVED*

Recommended Posts

I want to limit the amout of text that gets displayed from the database, which I can do using this statement:
[code]
$text = substr($message, 0, 80);
[/code]
Now I am trying to display only 40 char per line. I thought this would work:
[code]
  $text = substr($message, 0, 80);
  $trim = trim($text, 0, 40, " \r.");

echo nl2br("$name\n $trim \n $time\n");
[/code]
But that would of been to easy. Can someone please help me out? Many thanks.

Share this post


Link to post
Share on other sites
[code]<?php
$text = wordwrap(substr($message,0,80),40,"\r\n");
?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.