How to Remove the Last Character of a String in PHP
If you need to remove the last character of a string in PHP, then you can do the following:
Option 1 – Using rtrim()
Syntax: rtrim($string, $character)
Option 2 – Using substr()
Syntax: substr($string, $start, $length)