On Sunday 02 November 2003 11:50 am, Simon Stiefel wrote:
> Sorry, one correction:
> the 'chop()'-function only removes the whitespaces an the END of the
> string.
>
> But if you want to remove the newline (and only this) at the end of the
> string try this:
>
> $new_string = preg_replace("/\n$/", "", $old_string);

To expand on the idea, make it capable of Windows and MAC new lines also
$new_string = preg_replace("/\n|\r\n|\r$/", "", $old_string);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to