Php: How to remove last 3 characters from a string
To remove the last three characters from a string we can use the
substr() method by passing the
length as arguments.
Here is an example that removes the last three characters from a given string.
$name="John res"; //if length is negative it starts removing from the end $remove = substr($name,0,-3); echo $remove;