Cannot use object of type stdClass as array laravel

Viewed 3425

I know is simple but i don't know at this moment

In my controller i use

$result = DB::select("SELECT name FROM account_name WHERE name='".$name."'"); 

I can't get the data out from that array

dd($result) show me:

array:1 [
  0 => {#232
    +"name": "John"
  }
]

How to get that John out????

I have tried $result[0]["name"] but no success and give me that error

2 Answers
Related