Try the below:
function get_item($object, $key) {
// if there are no other code in this function, then `$$object` will not be defined.
// you can't get $user from the outside the function scope.
$value = $$object->{$key};
echo empty($value) ? 'do_stuffs' : 'dont_do_stuffs';
}
You are using variable variables, in most case, it's not a good idea.