Jump to content

[SOLVED] any tutorial on how to use wordwrap function?


johnwayne77

Recommended Posts

Ok, yeah I think wordwrap function is really only good when you are trying to keep a sentence to a minimal and wrapping the extra words to the next line. Your issue is that you have ONE word that is long..

 

I don't think wordwrap function will breakup your text....am I correct?

 

Use this:

 

                       ### Start StringTrim
		$string_count = strlen($name);

		if($string_count > 32) {

		$new_name = substr("$name", 0, 29);
		$new_name .= "...";
		$name = $new_name;
		}		
		### End StringTrim

 

 

You can set the "32" to whatever you want. And the "29" gives you the three dots (...)

 

 

 

well, that's what i want: the extra characters to brake up on the next line and so on.

 

i already truncate the text to a specific length..

 

i got this solution:

 

$string="7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777";
$row=chunk_split($string,50);
echo("<table><tr><td width='100'>".$row.";</td></tr></table>");

 

what do you say?

well, that's what i want: the extra characters to brake up on the next line and so on.

 

i already truncate the text to a specific length..

 

i got this solution:

 

$string="7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777";
$row=chunk_split($string,50);
echo("<table><tr><td width='100'>".$row.";</td></tr></table>");

 

what do you say?

 

If it works for you I say go for it!!

 

 

Archived

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

×
×
  • Create New...

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.