PHP chop() Function

PHP chop() function is used to remove whitespace from the end of a string.


string chop(str,charlist);

chop() Function Parameter

str :Required parameter. A string or text.
charlist :Optional parameter. Characters to be remove from the string.

chop() Function Return Value

Return Value :Returns the modified string.

chop() Function Example

echo chop("Hello world!   ");