Re: Perl style chomp()

From: Date: Thu, 01 Nov 2007 18:01:40 +0000
Subject: Re: Perl style chomp()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-263941@lists.php.net to get a copy of this message
mike wrote:
On 11/1/07, Jim Lucas <lists@cmsws.com> wrote:
I noticed, while perusing the chop() manual page, that some people were giving examples of Perl's chop() and chomp() functions. Comments made about both said the examples were good, but not correct.
what about trim(), rtrim() and ltrim() ? seems unnecessary to reinvent the wheel. if you want an array one, just make it recurse like you did. - mike
the functions that you mentioned do not do the same thing as what this function does. it alters a reference to the variable that you passed it and returns what it removed. The above listed functions return the altered string. Just a little difference. But, if you are comfortable using the Perl's chomp() function, then I think I created the PHP equivalent. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#263941) next »