Che se usi

strtolower($ext);

va bene...