PHP: All File Delete with Extension


 public function delete_all_file($dir=NULL,$ext=NULL){
        array_map('unlink', glob(".$dir."/*.".$ext."));
    }