Answer the question
In order to leave comments, you need to log in
How to reformulate the code?
There is an array
$items = [
[
'name'=> "1name",
'qual'=>34,
],
['name'=>'2name',
'qual'=>2
],
];
$My_qual= $item[$key]['qual'];
Answer the question
In order to leave comments, you need to log in
if you go strictly according to the task posed in the question, then you can take a list of object keys, take the one you need by number and use it,
but you definitely don’t need to do this, no one guarantees that the order of the elements in the key array will remain the same, you will have to double-check everything.
$items[$key][array_keys($items[$key])[1]]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question