array value within Rule's PHP action always gives 0 instead of related uid
I think the problem is with your $account variable. I don't see where it's instanciated in your code. It's probably related to the current logged in user, so you've to find a way to access this information from Rules. Try to use dsm($account); if you're using the devel module and check if the variable is empty.