Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Break apart a string at newlines?
July 18, 2007, 12:26 pm
rate this thread
I have a string variable, holding the results from a <textarea> of a POSTed
form. I want to create an array from this variable, with each element
containing one line of text from the string.
So, if $myvalue containst
Now is the time
for all good men
to come to the
aid of their country
I end up with this array...
$myvalues = 'Now is the time'
$myvalues = 'for all good men'
$myvalues = 'to come to the'
$myvalues = 'aid of their country'
How can I split this string, at the newlines, into an array? I also don't
want the newlines to be stored in the resulting array.