Re: [PHP] code with comments is here

2002-04-24 Thread Jason Wong
On Thursday 25 April 2002 00:14, Kirk Babb wrote: > I have a feeling I am making this much harder than it really is! I'm a new > programmer, and I am trying to output "x" number of characters per line > without splitting up the words in the string. I want to approach as best > as possible a cert

Re: [PHP] code with comments is here

2002-04-24 Thread Miguel Cruz
function wrap_lines ($str, $line_length) { $r = ''; $words = preg_split('/\s/', $str); $cur_pos = 0; foreach($words as $word) { if (($cur_pos + strlen($word) + 1) > $line_length) { $cur_pos = 0; $r .= ''; } else { $r .= ' '; $cur_pos++;

[PHP] code with comments is here

2002-04-24 Thread Kirk Babb
I have a feeling I am making this much harder than it really is! I'm a new programmer, and I am trying to output "x" number of characters per line without splitting up the words in the string. I want to approach as best as possible a certain number of characters per line, let's say 80 characters