trim the first 3 characters and the last 2 characters of string php code example Example: php remove last 3 letters from string echo substr($string, 0, -3);