Trying to find variable names from $user array
The best way to do this is use the devel module.

Once enabled you can use the dpm($variable) function to have it printed out on the screen.

Another (more complex to set up) solution would be to use xdebug and a debugger.