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