Posted by howarthc@gmail.com on 12/16/06 00:12
OK - here is what I want to do - but I am lost how to do it.
I have a variable
$mystring = "one two three four five six seven eight nine"
This variable $mystring can be 4 words long or it could be 50 words
long it is totally variable. What I want to do is take the number of
words in $mystring, divide by three and insert a <br> at the end of
each "line".
Example: $mystring = "one two three four five six seven eight nine"
Convert to:
one two three<br>
four five six<br>
seven eight nine<br>
Example: $mystring = "one two three four five six seven eight nine ten
eleven twelve"
Convert to:
one two three four<br>
five six seven eight<br>
nine ten eleven twelve<br>
I know I can use explode or strip with a field seperator of " " to
break the variable into component parts - but my non-programmer brain
is confused how I would do this.
Any assistance or pointers would be great... cheers,
Chris
Navigation:
[Reply to this message]
|