Remove characters on the right side of a string:
<?php$str = "Hello World!";echo $str . "<br>";echo chop($str,"World!");?>The chop() function removes whitespace characters or other predefined characters from the right side of a string.
chop( string,charlist )
parameter | describe |
---|---|
string | Required. Specifies the string to check. |
charlist | Optional. Specifies which characters are removed from the string. If the charlist parameter is empty, the following characters are removed: " |