Php $text = "The quick brown fox jumped over the lazy dog. "; $newtext = wordwrap($text, 20, "\n"); echo $newtext;? Result The quick brown fox jumped over the lazy dog.
Result The quick brown fox jumped over the lazy dog.
This does not split the words on every 5 characters like the OP asked for. – Michiel Pater Mar 21 at 14:03 1 @Michiel Pater: yeah I just suggested an easier way to handle , I thought he might have designed the string unknowing of this function! Your answer is to the point , I just gave a suggetion – Harish Mar 21 at 14:05 You are right, he might be searching for this!
– Michiel Pater Mar 21 at 14:08.
You could slice words that contain more than x characters using the following code. It will first split the string into lines by using the function explode(). It explodes on the tags.
Then it will loop through the lines and split the line into words for each line. Then for each word it will add after every 5 characters. And add the edited line to the variable $new_string.
Ath the end it echoes variable $new_string to display the edited string. To change the maximum word length, just change the variable $max_length. To change the input string, just change the variable $string.
Code $string = 'aaa bbbbwer sdfrert tyuo sdhryt kkkkkkkkkkkk sdfg'; $max_length = 5; $lines = explode('', $string); $new_string = ''; foreach($lines as $line) { $words = explode(' ', $line); foreach($words as $word) { $new_string . = substr(chunk_split($word, $max_length, ''), 0, -6) . ' '; } $new_string = substr($new_string, 0, -1) .''; } echo $new_string; Output aaa bbbbwer sdfrert tyuo sdhryt kkkkkkkkkkkk sdfg.
This does not split the words on every 5 characters like the OP asked for. – Michiel Pater Mar 21 at 14:05 Thanks for the quick replies! Although Michiel's answer probably addresses best the problem as I wrote it here, using wordwrap will work fine as well.
Cheers! – RLJ Mar 21 at 15:22 @RLJ I've merged your accounts together, you can now accept an answer as correct. I'd suggest you register; also, please read this Faq entry about cookie-based accounts.
– Will? Mar 21 at 15:43.
You could slice words that contain more than x characters using the following code. It will first split the string into lines by using the function explode(). It explodes on the tags.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.