Just to explain what's happened so you know next time.
You've used the constant 'localhost' without any quotes, because you hadn't previously called defined('localhost) or define('localhost', 'localhost'); PHP looked in the constants table but couldn't find localhost.
This in turn throws a warning, but also takes PHP to interpret that constant: localhost, as it's actual string value. 'localhost'.
This is another reason you should ensure you always use quotes when calling indexes in arrays (unless of course you want to call the constant value.)
E.g. $array['key'] is about 4-6x faster than $array[key] and also wouldn't cause problems if you had define('key', 'blah'); before hand. If you had then you would actually look for the $array['blah'] key.