September 2001
Intermediate to advanced
768 pages
32h 45m
English
string chop(string string) Strips trailing whitespace from a string.
Returns:
String stripped of trailing whitespace
Description:
chop() removes all trailing whitespace characters from the given string. These characters include the horizontal tab (\t), linefeed (\n), vertical tab (\013), carriage return (\r), and space (' '') characters.
Note:
Perl coders may be misled by this function’s name. Perl’s chop() function removes the last character from a string, while PHP’s chop() behaves more like Perl’s chomp(). To simulate the behavior of Perl’s chop(), see the examples.
Version:
PHP 3+, PHP 4+
See also:
To strip whitespace from the start and/or end of a string:
ltrim() rtrim() trim()
To grab a substring from a string:
substr()
Examples: ...
Read now
Unlock full access