Level 47
You don't need curly brackets for that. Just do it like this:
{{ $object->$property }}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to use a variable as object property and then show it. But when I run it, it fails and show me syntax error, unexpected ')' I want write something like this
$property = "name";
and then write in my blade template
{{$object->{$property}}}
How can I do this?
You don't need curly brackets for that. Just do it like this:
{{ $object->$property }}
Please or to participate in this conversation.