Table of Contents

Syntax

string chop(string $str [, string $charlist])

(PHP 4, PHP 5)

$str The string to manipulate (trim whitespace)
$charlist Optional string of characters to strip from the right side of $str
RETURNS Returns the modified string with the specified characters removed

What it Does

This function is an alias for the rtrim function. It trims specific characters (specified by $charlist) from the end of the string argument. If the optional $charlist argument is not specified, all whitespace characters will be removed.

Example

$test = chop("Something \t \n ");
echo '*' . $test . '*';

Outputs:

*Something*
 
chop.txt · Last modified: 2008/04/18 14:00 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki