The string input comes from textarea where users are supposed to enter every single item on a new line.
When processing the form, it is easy to explode the textarea
Following code must do the job
$string) { $split[$k] = trim($string); if (empty($split[$k])) unset($split[$k]); } ksort($split); $join = implode('', $split); ?>
to get string with newlinews completely stripped. It won't work correctly with JS though :(