We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How to get from object value with meta key


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}