Access value of array inside another array

I have an array an it is as follows as a result of dd().

dd($request->user['test'])

-result of dd()

  array:4 [
      "id" => 1
      "name" => "Test1"
      "created_at" => "2016-02-21 23:05:43"
      "updated_at" => "2016-02-21 23:05:43"
    ]

how can I access ‘name’ indide above array.

Answer

Try like this.

dd($request->user['test']['name']);

Leave a Reply

Your email address will not be published. Required fields are marked *