On Fri, 2003-06-20 at 15:47, Sparky Kopetzky wrote:
> I looked at the documentation on rtrim. It trims ALL whitespace characters
> from the end, not just the '\n'. I need only the '\n' trimmed.

Look again, but check out the second argument:

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);

$foo = "bar \n";
$bar = rtrim($foo);
$baz = rtrim($foo, "\n");
echo "\$foo == '$foo'; \$bar == '$bar'; \$baz == '$baz'\n";
?>


Good luck,

Torben


> Sparky
> ----- Original Message -----
> From: "Lars Torben Wilson" <[EMAIL PROTECTED]>
> To: "Sparky Kopetzky" <[EMAIL PROTECTED]>
> Cc: "PHP General" <[EMAIL PROTECTED]>
> Sent: Friday, June 20, 2003 16:47
> Subject: Re: [PHP] Chomp, Chomp, Chomp
> 
> 
> > On Fri, 2003-06-20 at 15:37, Sparky Kopetzky wrote:
> > > Does anyone have a piece of code that emulates a Perl 'Chomp' function?
> I need one.
> > >
> > > Thanks in advance!!
> > >
> > > Robin E. Kopetzky
> > > Black Mesa Computers/Internet Services
> > > www.blackmesa-isp.net
> >
> > This should do it for you:  http://www.php.net/rtrim
> >
> >
> > 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 ====-----
> >
> >
> >
-- 
 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