crzyman Posted September 16, 2006 Share Posted September 16, 2006 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. Link to comment https://forums.phpfreaks.com/topic/20992-help-with-using-trim-solved/ Share on other sites More sharing options...
zq29 Posted September 16, 2006 Share Posted September 16, 2006 [code]<?php$text = wordwrap(substr($message,0,80),40,"\r\n");?>[/code] Link to comment https://forums.phpfreaks.com/topic/20992-help-with-using-trim-solved/#findComment-93141 Share on other sites More sharing options...
crzyman Posted September 16, 2006 Author Share Posted September 16, 2006 Thanks! Works great. Link to comment https://forums.phpfreaks.com/topic/20992-help-with-using-trim-solved/#findComment-93147 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.