For strings, please use !== '' instead of empty. (Empty produces false positives, e.g. "0" will be empty as well.)