The original code is fine: array_key_exists() is slower.