I am very new to both PHP and Laravel. I want to dump specific information out of an array. I prefer not to use a foreach loop as I know the one I want.
Here is the array :
I want to display ICAR - Intermediate
I have tried :
dump($listofcarcodesnames[2]);
dump($listofcarcodesnames[2]['code']);
and
dump($listofcarcodesnames[2]->code);
and
dump($listofcarcodesnames->code[2]);
and
dump($listofcarcodesnames->$code[2]);
I am sure this is something simple that I am missing in the syntax but I can't figure it out. Without using a for loop to loop through every key and value how can I get both the key ICAR and the code part of the value of a given pair?
**CLEARIFICATION : **
Both of the responses below from @newUserName02 and @Carlos Gurrero partially give me what I need
$listofcarcodesnames['ICAR']['CODE']->code;
does work IF I know I am looking for ICAR
but if I only know I need the information from the 3rd position how do I get
$listofcarcodesnames[3rdKey]['CODE']->code;