We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to get from object value with meta key

Hello,

I have a users object with few properties [id, name, email]

I need to reach some property with defined key. Example:

$key = 'name';
echo $user->{$key};

Is there any way to do the same with volt?

edited Aug '14
{{ user.key }}

Isn't this working?

No. If you check compiled version, then {{ user.key }} will be <?php echo $user->key ?>

But I need $user->{$key}