substr($a,-7)= ""; # empty string! # or let the os handle the path $a .= '/..';