remove last two characters from a string php code example
Example 1: remove last letter php
<?php
echo substr('abcdef',0, -1); // abcde
?>
Example 2: php substr remove last 4 characters
echo substr($string, 0, -3);
<?php
echo substr('abcdef',0, -1); // abcde
?>
echo substr($string, 0, -3);