|
Posted by Harrie Verveer on 07/18/07 12:49
$myvalues = explode("\n",$myline);
Kind regards,
Harrie Verveer
---
http://www.ibuildings.nl/blog/authors/Harrie-Verveer
Noozer wrote:
> Small php question here...
>
> 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[0] = 'Now is the time'
> $myvalues[1] = 'for all good men'
> $myvalues[2] = 'to come to the'
> $myvalues[3] = '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.
>
> Thx!
>
>
[Back to original message]
|