Get data from YAML

I’m using the following code to get data from YAML like in this example:

echo $profiles['Twitter']['Username'];

Is there a way to use a variable instead ? Like this:

echo $profiles[$twitter]['Username'];

would make it easier if its used inside a template but doesn’t work for me.

Look at Docs: $field->yaml(), it is newer (Kirby 2.0.6) than your link (Kirby 1.x).

thank you @anon77445132.

in the meantime i found what i did wrong (i’m not used to PHP). i forgot the quotes:

echo $profiles[''.$clientID.'']['Username'];