列表项继续在PHP中的下一行

I am using a form to submit a list of items that I want to save to a config text file, but these list items should all be on the same line of the text file. Every time PHP breaks apart and puts the list items into the file, however, it automatically adds a new line before the </li> tag. Why? How do I prevent this.

CODE:

$pro = explode("
",$_POST["pro"]);
$proo = "<ul>";

for($index=0; $index<count($pro);$index++)
{
    $proo .= "<li>";
    $proo .= $pro[$index];
    $proo .= "</li>";
}

$proo .= "</ul>";

$proo = str_replace("
","",$proo);

Edit 1

If I echo $proo into the webpage, it looks like this:

<ul><li>List Item 1
</li><li>List Item 2
</li><li>List Item 3
</li><li>List Item 4
</li><li>List Item 5</li></ul>

Why are there line breaks before each </li>?

Somewhere in there, it's adding new lines...

Thanks!

David

I just had to add the following line:

$proo = str_replace("","",$proo);

For whatever reason, it was adding a return character. I don't know why still, but thanks for all your help.

line breaks can be tricky windows or linux and or so i added a trim to remove anything extra after the explode, seems to work. personally i would use a foreach() father than for() but thats just me

$_POST["pro"]="1
2
3
4";

$pro = explode("
",$_POST["pro"]);

$proo = "<ul>";
for($index=0; $index<count($pro);$index++)
{
    $proo .= "<li>".trim($pro[$index])."</li>";
}

$proo .= "</ul>";

echo $proo;

output:

<ul><li>1</li><li>2</li><li>3</li><li>4</li></ul>

In any system you are using PHP_EOL will aways equal to the appropriate End-Of-Line-char-sequence.

explode(PHP_EOL,$_POST["pro"]);

The code above will always work.

The line breaks (PHP_EOL values) are:
Windows:
*nix:
old Apple Macintosh's (new ones are based on unix):

PHP_EOL doc

Edit:
as pointed out by Dagon, browsers are using Windows' line-breaks by default.

explode("
",$_POST["pro"]);

is the way to go then