chop

(PHP 3, PHP 4 >= 4.0b1)

chop -- Remove trailing whitespace

Description

string chop (string str)

Returns the argument string without trailing whitespace, including newlines.

Example 1. chop() example


$trimmed = chop ($line);
      

Note: chop() is different than the Perl chop() function, which removes the last character in the string.

See also trim(), ltrim(), rtrim(), and chop().