I am trying to explode a string that has been entered in a textarea using the following:
$text = explode(" ", $text);
However if text has been entered in list format like this:
The tree is green
The sky is blue
The sun is yellow
The resulting array looks like this:
$text[0] = The
$text[1] = tree
$text[2] = is
$text[3] = green The
$text[4] = sky
$text[5] = is
$text[6] = blue The
$text[7] = sun
$text[8] = is
$text[9] = yellow
Is there a way that i can force a space at the start or end of each line before i explode the string so that the text doesn't group where there is a line break?