Re: Perl style chomp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mike wrote:
On 11/1/07, Jim Lucas <lists@xxxxxxxxx> 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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux