On Sun, 2003-06-08 at 22:44, Charles Kline wrote:
> Hi all,
> 
> How would i go about stripping all newlines from a string?
> 
> Thanks,
> Charles

Something like this:

<?php
error_reporting(E_ALL);

$str = "This string has unix\n and Windows\r\n and Mac\r line endings.";
$new_str = preg_replace('/[\n\r]+/', '', $str);
echo "$str; $new_str";
?>


Good luck,

Torben


-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




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

Reply via email to