It *may* be a speed improvement to do pathinfo($filename, PATHINFO_EXTENSION) than what you've got here. Plus it reads easier on the eyes