tedd wrote:
At 4:27 PM +0200 5/21/10, Anton Heuschen wrote:
So in the file it would look like (from the original file the user uploads
that is)
1
2
3
4
5
6
but when the file is saved to the server it must look like
1
2
3
4
5
6
If that is all (i.e., removing double linefeeds), then this will do it:
$text_array = array();
$text_array = explode("\n\n", $input_text);
$output_text = implode("\n",$text_array);
Sorry tedd, this is broken. It doesn't solve problems with runs of
greater than 2 newlines which is even in the example :) I would use the
following instead which is also line break agnostic with final output in
the style for your system:
<?php
$data = preg_replace( "#[\r\n]+#", PHP_EOL, $input );
?>
Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php