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 (...)

 

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!!

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.