PHP chop() Function

The chop() function is used to remove the whitespaces and other predefined characters from the right side of a string. This function is an alias of rtrim() function.

Example

<?php
$str = "Hello World!";
echo $str . "<br>";
echo chop($str,"World!");
?>

Output

Hello World!
Hello 

Leave a Reply

Your email address will not be published. Required fields are marked *