Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ihorrrrr's avatar

Use curly brackets insite double curly brackets in Laravel template

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?

0 likes
2 replies
rawilk's avatar
rawilk
Best Answer
Level 47

You don't need curly brackets for that. Just do it like this:

{{ $object->$property }}

Please or to participate in this conversation.