use count() instead of empty() since explode() returns an array.