php how to remove last 3 characters from string code example Example: php substr remove last 4 characters echo substr($string, 0, -3);