To eliminate duplicates, $langs[$file] = null is a good way to do so. Alternatively, use array_unique() afterwards but it's usually slower