Checking with user attribute

Permalink
Hi,

I have a very strange problem.

I'm using the user attributes to show certain data on a page.
The code:
$ua = UserAttributeKey::getByHandle('my_attribute');         
if ($profile->getAttribute($ua)) == 'option1') {
  echo "something";
} elseif ($profile->getAttribute($ua)) == 'option2') { 
  echo "something else";
}

The attribute "my_attribute" is a selection. When echoing the value directly, I see the values "option1" and/or "option2". But when I want to check which is selected I get nothing!

Seems that the if statement blocks the value in some way.

Can anybody help me with this problem?

Best,

Corretje

DeWebmakers