PHP chop() function
by Rekha[ Edit ] 2010-01-28 18:23:25
The chop() function will remove a white space or other predefined character from the right end of a string.
This function is an alias of the rtrim() function.
syntax:
chop(string,charlist)
Example:
<?php
$str = "Hello World!\n\n";
echo $str;
echo chop($str);
?>
In this example we will use the chop() function to remove characters from the right end of a string:
Output:
Hello World! Hello World!