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

vincej's avatar
Level 15

How to best extract values from an array inside Blade

Can't win either way. If I use array notation inside my blade file ie

$contractor['0']['first_name']

I get the error:

Cannot use object of type stdClass as array

Ok - so I try object notation:

{{$contractor->first_name}}

And I get the error:

Trying to get property of non-object

What am I doing wrong ??? Many Thanks !

ps - it is nto an error, you can not put curly braces around array notation when using markdown - they text will not render. weirde

0 likes
4 replies
bobbybouwmann's avatar

$contractor is probably null! Make sure it has a value!

dd($sonstractor);

Please or to participate in this conversation.